Table of Contents

Syslog

This documents the Hop.js builtin syslog api.

Use require("hop:syslog") to use it, or ` from "hop:syslog"`;* import

Additional information regarding syslog can be obtained in the Unix man page.

Functions

syslog.open(name, option, facility)

Initialize the syslog connection. The option argument is a bit-or combination of the following values:

The value facility must be one of:

syslog.log(level, msg)

Emit a log message. The argument msg is a string. The argument level denotes the importance of the message. The levels are, in order of decreasing importance:

syslog.close()

Closes the syslog connection.

Example

This example shows how to open a SYSLOG connection and how to emit messages.

syslog/syslog.js

var Syslog = require( hop.syslog );

Syslog.open( "hopjs-syslog", Syslog.LOG_PID | Syslog.LOG_ODELAY, Syslog.LOG_LOCAL0 );

Syslog.log( Syslog.LOG_INFO, "A hop.js message [v" + process.versions.hop + "]" ) ;

Syslog.close();

console.log( "check your log file (typically /var/log/syslog)" );