Skip to content

gdw2/winston-syslog2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

winston-syslog

A Syslog transport for winston. I started out with https://github.com/indexzero/winston-syslog, but plugged in node-syslog.

Installation

  $ npm install winston 
  $ npm install winston-syslog2

Usage

To use the Syslog transport in winston, you simply need to require it and then either add it to an existing winston logger or pass an instance to a new winston logger:

  var winston = require('winston');
  
  //
  // Requiring `winston-syslog` will expose 
  // `winston.transports.Syslog`
  //
  require('winston-syslog');
  
  winston.add(winston.transports.Syslog, {level: ‘emerg’});

Log Levels

Because syslog only allows a subset of the levels available in winston, levels that do not match will be ignored. Therefore, in order to use winston-syslog effectively, you should indicate to winston that you want to use the syslog levels:

  var winston = require('winston');
  winston.setLevels(winston.config.syslog.levels);

The Syslog transport will only log to the level that are available in the syslog protocol. These are (in increasing order of severity):

  • debug
  • info
  • notice
  • warning
  • error
  • crit
  • alert
  • emerg

There is currently a bug in winston where the syslog levels are mapped backwards. Because of this, you will probably want to set the log level to ‘emerg’ as seen in the example above.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published