Skip to content
Snippets Groups Projects
Commit 503424c5 authored by Sigmund, Dominik's avatar Sigmund, Dominik
Browse files

udp buffer fix

parent 4b51baa7
No related branches found
No related tags found
1 merge request!1Update index.test.js, examples/all-options.js, examples/log-to-file.js,...
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
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment