Skip to content

responsivedevelopment2/winston-modern-syslog

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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-with-circular-reference-protection

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

About

A syslog transport for winston using the modern-syslog package with circular reference protection

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%