console-syslog

1.0.52 • Public • Published

console-syslog

A console & syslog simple logger.

Version npmnpmDownloads

NPM

Installation

Installing npm (node package manager)

  $ curl http://npmjs.org/install.sh | sh

Installing console-syslog

  $ npm install console-syslog

Usage

To use this logger, you simply need to require it passing your options to configure it:

let options = {
  app_name: "your app name",
  device: "your app device",
  syslog_host: "a syslog host",
  syslog_port: "a syslog port",
  hostname: "your app host",
  timestamp: true
}
let logger = require("console-syslog")(options);
 
logger("info", "This is the message", { statusCode: 200, foo: "bar" })

An aditional "priority" field is added and setted to the log level.

This syslog doesn´t accept all of the RFC 5424 compliant parameters, so use it on your own risk. The parameters accepted on the options are as follows:

  • app_name: The app that generates the logs. (default: "default app")
  • device: The device the app is running on. (default: "default device")
  • syslog_host: The syslog server host to send syslog messages. (default: "localhost")
  • syslog_port: The syslog server port to send syslog messages. (default: 5556)
  • hostname: Your app host. (default: "localhost")
  • timestamp: Set to true to print a timestamp with format YYYY-MM-DDTHH:mm:ss. (default: true)

Readme

Keywords

Package Sidebar

Install

npm i console-syslog

Weekly Downloads

5

Version

1.0.52

License

ISC

Unpacked Size

3.91 kB

Total Files

3

Last publish

Collaborators

  • tinocle