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 🙏

© 2026 – Pkg Stats / Ryan Hefner

winston-simple

v1.0.8

Published

A simple, log4j style wrapper for logging. Easier to setup and use than the default Winston configuration.

Readme

winston-simple

A simple, log4j style wrapper for Winston logging. Easier to setup and use than the default Winston configuration.

Table of Contents

  1. Installation
  2. Source / Webpage
  3. Usage
    1. Log Levels
    2. Configuration
    3. Log Format
    4. Usage in Code
    5. Customization
  4. Example
  5. License

Installation


You can install winston-simple in your project's node_modules folder, or you can install it globally.

To install the latest version available on NPM:

npm install winston-simple

To install the latest development version:

npm install git+https://github.com/sseaman/winston-simple.git

Source / Webpage


winston-simple is maintained in GitHub. For full source to to GitHub winston-simple

Usage


winston-simple is a log4j style wrapper for Winston logging that supports per object log level setting, global log level setting, or global disabled logging. winston-simple uses simple map configuration to determine how logging is contolled.

Log Levels

winston-simples uses the same npm logging levels of Winston with one addition: none, which will disable logging for a specifed object.

The full list of logging levels are: { none, error: 0, warn: 1, info: 2, verbose: 3, debug: 4, silly: 5 }

Configuration

winston-simple uses a map to set the log levels of the objects that you wish to control the logging level. The key of the map represents the name of the object. The value is the level of the logging. Once the logging level is set in winston-simple you never need to set it again, but you can modify it at any time and it will apply the changes to the logging levels realtime.

Per Object Configuration

{
	"MyObjectName"  : "debug",
	"AnotherObject" : "info",
	and so on
}

The above would set the the log level of MyObjectName to debug and AnotherObject to info. All other objects will have logging disabled.

Global Configuraton

winston-simple supports the idea of global configuration for all objects that wish to do logging. To enable global logging levels use the all key for the map. The value is the level of the logging to apply to all object.

{
	"all" : "debug"
}

The above would set all logging levels for all objects to "debug".

You can also disable logging for all objects by setting the logging levels to:

{
	"all" : "none"
}

Combining Global and per object

winston-simple also support a combination of per object and global configuration. This allow a default log level to be set for all object levels but different specific levels for certain objects

Example:

{
	"all" 			: "debug",
	"MyObjectName"	: "info"
}

Log Format

winston-simple defaults to the standard Winston configuration, but with the addition of the Object name as a label. This results in the following formatted log entry:

2016-10-07T19:24:56.995Z - info: [MyObjectName] This is the log message

Usage in Code

To set the log levels used by winston-simple first require the npm package and then set the logging level.

var Logger = require('winston-simple);
Logger.setLevels({
	'all' : 'debug',
	'MyObjectName' : 'info'
});

You can the use the Logger to get a logger for use in your code:

var log = Logger.getLogger('MyObjectName');

log.debug("This is a debug message");

Customization

winston-simple exposes it's underlying Winston instance so that you may configure winston-simple however you want.

To retreived the instance, simply call getWinston() on your winston-simple instance. Any changes made to the returned Winston object will be applied to all loggers.

Example


The following example shows the tightest way to initialize winston-simple.

/index.js

var log = require('winston-simple').setLevels(
	{
		'all' : 'info',
		'SomeObject' : 'debug'
	}).getLogger("Index");

//some code....
log.info("This will be logged");
log.debug("This will NOT be logged");

/lib/SomeObject.js

var log = require('winston-simple').getLogger('SomeObject');

log.info("This will be logged");
log.debug("This will also be logged because it was configued in index.js");

License


winston-simple is copyright (c) 2016-present Sloan Seaman [email protected].

winston-simple is free software, licensed under the Apache License, Version 2.0.