console-syslog
v1.0.52
Published
This is a npm module that log messages and objects to console and through syslog
Downloads
1
Readme
console-syslog
A console & syslog simple logger.
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
)