0.0.10 • Published 1 year ago

etaglogger v0.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

(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.

license

MIT

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago