0.0.4 • Published 5 years ago

layer-logging v0.0.4

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

layer-logging

Build Status Coverage Status

Getting Started in 1 Minute

1) Provides logging levels:

  • ERROR
  • WARN
  • INFO
  • DEBUG
  • TRACE
  • SILENT 2) You can't set the level to SILENT (It's special). 3) To use the logger, you instantiate it preferably providing at least one key. 4) You can use the static properties filterIn and filterOut to override the current level. 5) If a key is specified in filterIn the log will go out no matter the level. 6) Same with filterOut, but if a key is specified on both in and out, it will be skipped. 7) The only way to echo SILENT logs, is by including the key in filterIn

Examples

Create Logger and Use It

const logger = new Logger('app');
logger.trace("Hello", "World");
// Prints:
// [2025-01-01T18:04:38.233Z] [INFO]   [APP] Hello World

Log at Different Levels

const logger = new Logger('app');
Logger.setLevel('INFO');
logger.error('Something happened');         // Will go out
logger.trace('Small bit');                  // Won't go out
logger.silent('Specific debug');            // Will never go out if 'app' is not on Logger.filterIn
0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago