etaglogger
v0.0.10
Published
tag loger for debug
Downloads
53
Readme
(E)tag logger
Simple logger for console output
install
npm i etaglogger
usage
// in first file:
const TagLogger = require('etaglogger');
const logd = TagLogger('file1');
logd('test string', { data: 'test data' }, ['tag1']) // log message tagged by two tags: tag1, file1
logd('test2 string', { data: 'test data' }, ['tag1', 'tag2']) // log message tagged by tags: tag1, tag2, file1
// in second file
const TagLogger = require('etaglogger');
const logd = TagLogger('file2');
...
logd('test3 string'); // tag: file2
Last variable of logd function can be array of tags.
After run you can enable logs by set DEBUG environment variable
DEBUG=!tag1;tag2;!file1;test;tag3,tag4 // show logs with tags: test, tag2 and combinatoion of tag3 + tag4
// or splitter - ';'
// and splitter - ','
for all logs you can use next:
DEBUG=*
Exclamation mark use for disable tags withour remove it.
If all tags are disabled or DEBUG variable is not set - taglogger will be disabled.