From 77068b73f876db5a5f9c0b2901434aca6a53e157 Mon Sep 17 00:00:00 2001 From: Dustin Koupal Date: Wed, 16 Mar 2016 16:34:06 -0700 Subject: [PATCH] adding process id, and facility when using syslog system call --- lib/sys.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/sys.js b/lib/sys.js index 5b691f2..fa849fa 100644 --- a/lib/sys.js +++ b/lib/sys.js @@ -108,7 +108,7 @@ function SyslogStream(opts) { this.writable = true; if (this.constructor.name === 'SyslogStream') { - binding.openlog(this.name, binding.LOG_CONS, 0); + binding.openlog(this.name, binding.LOG_CONS | binding.LOG_PID | binding.LOG_NDELAY, this.facility * 8); process.nextTick(this.emit.bind(this, 'connect')); } } @@ -160,15 +160,15 @@ SyslogStream.prototype.write = function write(r) { throw new TypeError('record (Object) required'); } - l = (this.facility * 8) + (l !== undefined ? l : level(bunyan.INFO)); - var hdr = sprintf('<%d>%s %s %s[%d]:', - l, - (t || time()), - (h || HOSTNAME), - this.name, - process.pid); if (this._send) { + l = (this.facility * 8) + (l !== undefined ? l : level(bunyan.INFO)); + var hdr = sprintf('<%d>%s %s %s[%d]:', + l, + (t || time()), + (h || HOSTNAME), + this.name, + process.pid); this._send(hdr + m); } else { binding.syslog(l, m);