An event- and stream-aware logger for pros. Meaning, professionals.
npm install prologAn event- and stream-aware logger for pros. Meaning, professionals.
npm install prolog``javascript
// Create a logger. Simple.
var ProLog = require('prolog').ProLog;
var log = new ProLog();
log.log('This goes to stdout.');
log.error('This goes to stderr.');
log.group();
log.info('This is indented...');
log.groupEnd();
log.warn('But this is not!');
// This logger forwards all its messages to the parent "log" logger, but
// adds an additional child-only "childonly" level and removes the "error"
// level. Also, group indentation is cumulative.
var childlog = new ProLog(log, {
levels: {
error: null,
childonly: '[child] %s%s',
},
});
childlog.log('This goes to the parent, then to stdout.');
childlog.childonly('This goes to the parent, then to stdout.');
childlog.error('This throws an exception, whoops!');
``
_Total work-in-progress. Haven't added the stream or progress stuff yet._
See the examples directory for code-as-documentation.