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

final graylog fix

parent 9f8bc771
No related branches found
No related tags found
1 merge request!1Update index.test.js, examples/all-options.js, examples/log-to-file.js,...
...@@ -41,8 +41,8 @@ function Log (options) { ...@@ -41,8 +41,8 @@ function Log (options) {
} catch (err) { } catch (err) {
try { try {
this.fs.writeFileSync(this.path.join(this.options.path, this.options.file), '', { flag: 'wx' }) this.fs.writeFileSync(this.path.join(this.options.path, this.options.file), '', { flag: 'wx' })
} catch (err) { } catch (innerErr) {
throw new Error('Could not Create File ' + this.options.file + '\n' + err.toString()) throw new Error('Could not Create File ' + this.options.file + '\n' + innerErr.toString())
} }
} }
} }
...@@ -121,11 +121,11 @@ function Log (options) { ...@@ -121,11 +121,11 @@ function Log (options) {
} }
if (this.options.graylog && this.options.graylog.active) { if (this.options.graylog && this.options.graylog.active) {
let data = JSON.stringify({ let data = JSON.stringify({
short_message: msg, short_message: message,
timestamp: Date.now() / 1000, timestamp: Date.now() / 1000,
host: this.hostname, host: this.hostname,
facility: this.name, facility: this.name,
level: tag level: this.levels[tag]
}) })
this.udpclient.send(Buffer.from(data),this.options.graylog.port,this.options.graylog.server,function(error){ this.udpclient.send(Buffer.from(data),this.options.graylog.port,this.options.graylog.server,function(error){
if(error){ if(error){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment