From 503424c5310c759316c1ff6faa44a737a19640e7 Mon Sep 17 00:00:00 2001
From: Dominik Sigmund <dominik.sigmund@br.de>
Date: Fri, 8 May 2020 09:31:58 +0200
Subject: [PATCH] udp buffer fix

---
 index.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/index.js b/index.js
index 90e2a5a..f6c7386 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
   }
-- 
GitLab