winston-modern-syslog
A syslog transport for winston that is a simple wrapper for the modern-syslog library.
Installation
npm install --save winston-modern-syslog
Usage
To use the ModernSyslog transport in winston, simply require the module and then attach it to the winston logger, or a logger of your own creation:
var winston = ; // Requiring the module will return `winston.transports.ModernSyslog`; // Tell winston that you're using the syslog levels instead of the defaultswinston; winston;
The ModernSyslog transport has the following options:
- level: Level of messages that this transport should log (default 'info').
- label: The message prefix (default
process.title
). - logPid: Whether to log the application's PID with the log messages (default false).
- facility: syslog facility (default
syslog.facility.LOG_USER
). - prefixLevel: Whether to prefix the log level on the log messages (default false).
As syslog only supports a subset of the levels available in winston, in the example above we explicitly configure winston to use the syslog levels.
Metadata objects are logged via JSON.stringify(meta)
.
Tests
The tests are written in Mocha. They can be run with npm:
npm test