From 9d528551d68cfeb0881ab476304522ca66915ced Mon Sep 17 00:00:00 2001
From: Dominik Sigmund <dominik.sigmund@br.de>
Date: Fri, 8 May 2020 10:05:19 +0200
Subject: [PATCH] more fixing

---
 index.js | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/index.js b/index.js
index 69a814c..5ca8d8b 100644
--- a/index.js
+++ b/index.js
@@ -1,5 +1,3 @@
-const udp = require('dgram')
-
 function Log (options) {
   this.levels = {
     'DEBUG': 5,
@@ -27,7 +25,8 @@ function Log (options) {
     this.hostname = os.hostname()
   }
   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) {
     this.fs = require('fs')
@@ -122,11 +121,11 @@ function Log (options) {
     }
     if (this.options.graylog && this.options.graylog.active) {
       let buffed = Buffer.from(JSON.stringify({
-        short_message: message,
+        short_message: msg,
         timestamp: Date.now() / 1000,
         hostname: this.hostname,
         facility: this.name,
-        level:tag
+        level: tag
         }))
       this.udpclient.send(buffed, 0, buffed.length, this.options.graylog.port, this.options.graylog.server, (error) => {
         if (error) {
-- 
GitLab