0.0.4 • Published 5 years ago
layer-logging v0.0.4
layer-logging
Getting Started in 1 Minute
1) Provides logging levels:
ERRORWARNINFODEBUGTRACESILENT2) You can't set the level toSILENT(It's special). 3) To use the logger, you instantiate it preferably providing at least onekey. 4) You can use the static propertiesfilterInandfilterOutto override the current level. 5) If a key is specified infilterInthe log will go out no matter the level. 6) Same withfilterOut, but if a key is specified on bothinandout, it will be skipped. 7) The only way to echoSILENTlogs, is by including thekeyinfilterIn
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 WorldLog 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