bunyan-console-stream
v0.1.0
Published
simple bunyan console logging stream
Downloads
10
Readme
Simple bunyan console logging stream
Logs bunyan message text to STDOUT.
Output is directed to STDERR if a message's level ("fatal" (60), "error" (50), "warn" (40), "info" (30), "debug" (20), "trace" (10))
is greater or equals the value set by option stderrThreshold
:
var bunyan = require('bunyan');
var consoleStream = require('bunyan-console-stream');
// ...
var stream_options = {
stderrThreshold:40 //log warning, error and fatal messages on STDERR
};
var logger = bunyan.createLogger({
name: loggerName,
streams: [
{
type: 'raw',
stream: consoleStream.createStream(stream_options)
},
//...
]
});
// ...
logger.info('Success!'); // STDOUT output: INFO: Success!
logger.error('Fail.'); // STDERR output: ERROR: Fail.