node-syslog-client-bsd
v1.0.1
Published
Wrapper for https://www.npmjs.com/package/syslog-client package
Downloads
4
Readme
node-syslog-client-bsd
Wrapper for https://www.npmjs.com/package/syslog-client package
Install
yarn add node-syslog-client-bsd
or npm i node-syslog-client-bsd
Usage
Import package
const SyslogClient = require("node-syslog-client-bsd");
new SyslogClient(IP, [options]);
IP
: IP of your syslog server[options]
: can be find here : https://www.npmjs.com/package/syslog-client#syslogcreateclienttarget-options
Return new instance of SyslogClient (constructor)
const options = {
syslogHostname: 'home-api.local',
};
const logClient = new SyslogClient('10.0.0.15', options);
SyslogClient.getClient()
Return the instance of syslog-client based on syslog-client package
SyslogClient.setProgram(program)
sets the program for all calls according to the setter
SyslogClient.resetProgram()
reset the program for all calls according to the reset
SyslogClient.setFacility(facility)
sets the facility for all calls according to the setter
SyslogClient.resetFacility()
reset the facility for all calls according to the reset
log(message, [program], [options])
message
: message to log[program]
: set the program specific for one log. DefaultN/A
[options]
: options based on syslog-client options. It overloads what you've already set up
you have access to all these functions depending on the level
logClient.info('Log infos!');
logClient.warning('Log warning!');
logClient.error('Log error!');
logClient.debug('Log debug!');
logClient.emergency('Log emergency!');
logClient.alert('Log alert!');
logClient.critical('Log critical!');
logClient.notice('Log notice!');
Example
You can find an example in ./example/index.js
. The screenshot below shows you its result (on an Synology NAS)
Useful links
- https://www.npmjs.com/package/syslog-client
- https://www.ietf.org/rfc/rfc3164.txt
- https://tools.ietf.org/html/rfc5424
Changelog
March 2019
- Init project