diff --git a/index.js b/index.js index 90e2a5a9ab39b9f40a4ef55a5ab14faecfdd3301..f6c73867a233fbc4ac6905fa29fdd438e392a8eb 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ const udp = require('dgram') -const buffer = require('buffer') +const Buffer = require('buffer') const graylog = udp.createSocket('udp4') function Log (options) { @@ -121,13 +121,18 @@ function Log (options) { }) } if (this.options.graylog && this.options.graylog.active) { - graylog.send(Buffer.from(JSON.stringify({ + let buffed = Buffer.from(JSON.stringify({ short_message: message, timestamp: Date.now() / 1000, hostname: this.hostname, facility: this.name, level:tag - })), this.options.graylog.port, this.options.graylog.server, function(error){}) + })) + graylog.send(buffed, this.options.graylog.port, this.options.graylog.server, function(error){ + if (error) { + console.error(error) + } + }) } return msg }