loglevels

8.0.3 • Public • Published

LogLevels npm version Build Status

About:

Sensual, single file, no dependency, colour logger. Just for you baby🐬.

install:

npm install loglevels

usage:

'use strict';
 
/* On-Switch (special environment variable): */
process.env.LOG_LEVELS_ON_FOR_COMPONENTS = 'component_a component_b component_c';
 
/* regular environment variables: */
// process.env.ROOT_LOGGER_PATH = 'music_app';
// process.env.LOG_LEVELS = 'debug warn critical';
// process.env.LOGGER_COLOUR_OFF = 'true';
 
const component = 'component_b';
 
const logger = require( 'loglevels' ).setLocationAndGetLogger( __filename, component );
 
logger.debug( 'your message here' );
logger.info( 'your message here' );
logger.warn( 'your message here' );
logger.error( 'your message here' );
logger.critical( 'sexy monkey' );

This code sample logs the following:

(__filename in this example is '/Users/michaelstecky-efantis/music_app/loglevels/music_app/loglevelsTest.js') alt text

With all the regular environment variables uncommented, the code sample above logs the following:

alt text

Package Sidebar

Install

npm i loglevels

Weekly Downloads

29

Version

8.0.3

License

ISC

Unpacked Size

8.23 kB

Total Files

4

Last publish

Collaborators

  • npm.m.stecky.efantis