From 4c74d2a04ce98554a1db43436effa81899f3f1e4 Mon Sep 17 00:00:00 2001
From: Dominik Sigmund <dominik.sigmund@br.de>
Date: Fri, 8 May 2020 09:52:37 +0200
Subject: [PATCH] init error

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

diff --git a/index.js b/index.js
index 2fb5b07..b58f79c 100644
--- a/index.js
+++ b/index.js
@@ -26,6 +26,9 @@ function Log (options) {
     let os = require('os')
     this.hostname = os.hostname()
   }
+  if (this.options.graylog && this.options.graylog.active) {
+    this.udpclient = udp.createSocket('udp4')
+  }
   if (this.options.file) {
     this.fs = require('fs')
     this.path = require('path')
@@ -34,9 +37,6 @@ function Log (options) {
     } catch (error) {
       throw new Error('Could not create path ' + this.options.path + '\n' + error.toString())
     }
-    if (this.options.graylog && this.options.graylog.active) {
-      this.udpclient = udp.createSocket('udp4')
-    }
     try {
       this.fs.accessSync(this.path.join(this.options.path, this.options.file), this.fs.constants.R_OK | this.fs.constants.W_OK)
     } catch (err) {
-- 
GitLab