Socket
Socket
Sign inDemoInstall

loggerhythm

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loggerhythm

wrapper for winston to use it like debug with namespaces


Version published
Weekly downloads
17
increased by183.33%
Maintainers
3
Weekly downloads
 
Created
Source

Loggerhythm

A winston-wrapper to log in a debug-like manner including namespaces

Usage

Loggerhythm exports a function, which requires a namespace and returns the logger-class. This class has different log-functions for different log-levels. By default, the avaliable loglevels are:

  • critical
  • error
  • warn
  • info
  • verbose
  • debug
  • silly
Example
const logger = require('loggerhythm')('readme-namespace');

logger.info('foo');
logger.warn('bar');

The output would look like this (the different log-leves use different colors):

2016-08-30T14:06:33.751Z - info:     [readme-namespace] foo
2016-08-30T14:06:33.752Z - warn:     [readme-namespace] bar

Methods

alongside the different log-methods you have (within setup) the setLevel-method to tell the module, what the minimal loglevel is a message needs to have to be logged. This setting is global, and will effect all loggers. You also have this method, if you only require loggerhythm, without giving it a namespace, although you cannot use these non-namespaced instances to log things.

const logger = require('loggerhythm')('readme-namespace');

logger.setup.setLevel('warn');
logger.info('foo');
logger.warn('bar');

or

const logger = require('loggerhythm')('readme-namespace');
const someOtherLogger = require('loggerhythm');

someOtherLogger.setup.setLevel('warn');
logger.info('foo');
logger.warn('bar');

will output:

2016-08-30T14:14:48.520Z - warn:     [readme-namespace] bar

Todo

Loggerhythm can not yet log to files, only to the console. It is planned that logs can be stored to files independent of the DEBUG-environment-variable. With that, you could get a complete, persistent log, aswell as the DEBUG-filtered console-output.

FAQs

Package last updated on 11 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc