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

more fixing

parent d23ebf00
Branches
Tags
1 merge request!1Update index.test.js, examples/all-options.js, examples/log-to-file.js,...
const udp = require('dgram')
function Log (options) { function Log (options) {
this.levels = { this.levels = {
'DEBUG': 5, 'DEBUG': 5,
...@@ -27,7 +25,8 @@ function Log (options) { ...@@ -27,7 +25,8 @@ function Log (options) {
this.hostname = os.hostname() this.hostname = os.hostname()
} }
if (this.options.graylog && this.options.graylog.active) { if (this.options.graylog && this.options.graylog.active) {
this.udpclient = udp.createSocket('udp4') this.udp = require('dgram')
this.udpclient = this.udp.createSocket('udp4')
} }
if (this.options.file) { if (this.options.file) {
this.fs = require('fs') this.fs = require('fs')
...@@ -122,7 +121,7 @@ function Log (options) { ...@@ -122,7 +121,7 @@ function Log (options) {
} }
if (this.options.graylog && this.options.graylog.active) { if (this.options.graylog && this.options.graylog.active) {
let buffed = Buffer.from(JSON.stringify({ let buffed = Buffer.from(JSON.stringify({
short_message: message, short_message: msg,
timestamp: Date.now() / 1000, timestamp: Date.now() / 1000,
hostname: this.hostname, hostname: this.hostname,
facility: this.name, facility: this.name,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment