winston-modern-syslog-with-circular-reference-protection

3.0.0 • Public • Published

winston-modern-syslog

Build Status

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 = require('winston');
 
// Requiring the module will return `winston.transports.ModernSyslog`
require('winston-modern-syslog');
 
// Tell winston that you're using the syslog levels instead of the defaults
winston.setLevels(winston.config.syslog.levels);
 
winston.add(winston.transports.ModernSyslog, {level: 'alert'});

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

Package Sidebar

Install

npm i winston-modern-syslog-with-circular-reference-protection

Weekly Downloads

1

Version

3.0.0

License

MIT

Unpacked Size

8.89 kB

Total Files

6

Last publish

Collaborators

  • responsivedevelopment2