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

newheelog

v1.0.8

Published

New-wheel-logger, a simple convention-over-configuration logger for NodeJs service.

Downloads

39

Readme

newheelog

A new-wheel-logger for NodeJs. Simple do its task.

A previous version was based on winston and winston daily rotate file. There are some traps when used with cluster based workers. So New-wheel Logger is created.

  • Short logging api: as it should be
  • Self contained tiny code. No additional dependencies
  • Optionally write log to file, with rotation based on size
  • Optionally decorate console, with colors
  • Log time, level, and auto-detected file/module name.
  • support custom label (for cluster mode workers, etc)
  • NodeJs default console.log/util.format convension

//easy api
const log = require('newheelog')()

log('log')

//explicit level
log.debug('log.debug')
log.info('log.info')
log.warn('log.warn')
log.error('log.error')

//formatting
let d = {a: 1, b:'Transylvania'}
log('Formatting: %d %s %j', 12345, 'welcome to', d)
log('test error with stack:', new Error('demo'))

//alternatives
const {info, warn, error} = require('newheelog')()
Promise.reject('Hello, mortal')
	.then(info)
	.catch(error)

newheelog screenshot

Options

const nwlog = require('newheelog')

nwlog.config({
	//decorateConsole: true,		//whether decorate console.log/console.error. Default: true
	//writeToConsole: true,			//whether write to console for log operations. Default: true
	fileName: './log/console.log',	//If not null, a log file will be created. Default: null
	//maxLength: 4 * 1024 * 1024,		//max file length
	//maxFiles: 3,				//max log files to keep
	//custom: () => 'custom-label-' + process.pid,	//A function to append custom label. E.g. add pid
	//maskPassword: true			//If enabled, tries to identify password string fields in logged objects and mask them. Default: false
	//moduleNamePadding: 12,		//Padding for module name. 0 for no padding. Default: 12
	//longLevelName: false			//Use long level name (e.g. "ERROR") instead of short level name (e.g. "E"). Default: false
})

const log = nwlog()
log('log')