1.1.0 • Published 10 months ago

logger-emitter v1.1.0

Weekly downloads
46
License
MIT
Repository
github
Last release
10 months 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-2024 Jürgen Leschner, MIT license

1.1.0

10 months ago

1.0.10

3 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago