Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions lib/winston-syslog.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var Syslog = exports.Syslog = function (options) {
this.label = options.label || null;
this.logstash = options.logstash || false;
this.depth = options.depth || null;
this.silent = options.silent || false;

//
// Merge the options for the target Syslog server.
Expand Down Expand Up @@ -118,23 +119,27 @@ Syslog.prototype.name = 'Syslog';
// Core logging method exposed to Winston. Logs the `msg` and optional
// metadata, `meta`, to the specified `level`.
//
Syslog.prototype.log = function (level, msg, meta, callback) {
var self = this,
syslogMsg,
buffer;
Syslog.prototype.log = function (timestamp, level, msg, meta, callback) {
if (this.silent) {
return callback(null, true);
}

if (!~levels.indexOf(level)) {
return callback(new Error('Cannot log unknown syslog level: ' + level));
}

var self = this,
syslogMsg,
buffer;

var output = common.log({
colorize: this.colorize,
json: this.json,
level: level,
message: msg,
meta: meta,
stringify: this.stringify,
timestamp: this.timestamp,
timestamp: null,
showLevel: this.showLevel,
prettyPrint: this.prettyPrint,
raw: this.raw,
Expand All @@ -149,7 +154,7 @@ Syslog.prototype.log = function (level, msg, meta, callback) {
severity: level,
host: this.localhost,
app_id: this.appId || process.title,
date: new Date(),
date: timestamp || this.timestamp || new Date(),
message: output
});

Expand Down