npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mazeltov/logger

v1.0.2

Published

Wrapper for winston supporting multiple transports and file rotation

Downloads

2

Readme

General Logger

console.log is okay for playing around, but a serious logger provides:

  • Log levels (error, warn, info, debug)
  • Multiple transports (stdout, file)
  • File rotation
  • Clear indications where the logger printed

So this is a lot to set up per project which is why a re-usable catch all was made

Basic Usage


// load .env file. See Configuration
require('dotenv').config();

const loggerLib = require('@mazeltov/logger');

// then multiple loggers can be produced for each file
const logger = loggerLib('distinct log identifier');

// then elsewhere in another file
const logger2 = loggerLib('different identifier');

Configuring

This logger depends on your project using dotenv.

In .env file (these are default values)

LOG_LEVEL=info

# comma separated list. stdout, file
LOG_TRANSPORTS=stdout

# will only log to file if file is included as transport
LOG_DIR='./log'

# See Tabbing
LOG_TAB_CHAR='..'
LOG_MAX_TAB=4

# Default is pipe delimited but JSON format can be used
LOG_FORMAT=json

Tabbing

Something unique about this wrapper is that you can 'tab' and 'untab' your log output.

That way you don't have to prepend everything with \\t. Just be sure to untab with shiftTab

logger.info('Diving into the code:');
logger.tab();
logger.info('This code is indented');
logger.info('So is this code');
// do not forget this!
logger.shiftTab();

Roadmap

TODO

  • Logger may need some performance tweaks
  • Logger does not have remote transports (like logging to syslogd or a service)