1.0.10 • Published 2 years ago

logger-emitter v1.0.10

Weekly downloads
46
License
MIT
Repository
github
Last release
2 years ago

logger-emitter

CI

Minimal api for logging to console and/or eventEmitter

usage:

var loggerEmitter = require('logger-emitter');

// new is optional
// usually all you want is a standalone log() function
var log = loggerEmitter(opts).log;

// simply call log() without object. prefix
// supports util.format() args, returns formatted string

log(s...);

// log error with stack trace

log(new Error(...));

// access the logger object
log.logger.noConsole = true;
log.logger.noErrors = true

// to add listeners
log.logger.on('log', logHandler);
log.logger.on('error', errHandler);

opts.noConsole

  • suppresses console logging

opts.noErrors

  • emits only 'log' events instead of 'log' and 'error' events
  • if you don't listen for errors, eventEmitter will throw on 'error'

license

Copyright (c) 2015-2022, Jürgen Leschner, MIT license

1.0.10

2 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

6 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago