From 460f344ec88699d74619073bfdf22956248690d7 Mon Sep 17 00:00:00 2001
From: Domink Sigmund <sigmund.dominik@googlemail.com>
Date: Fri, 28 Sep 2018 10:18:30 +0200
Subject: [PATCH] cleanup

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

diff --git a/index.js b/index.js
index 57c15b2..fa4e4a6 100644
--- a/index.js
+++ b/index.js
@@ -1,13 +1,19 @@
 function Log (options) {
-  this.fs = require('fs')
-  this.os = require('os')
   this.options = options || {}
   if (this.options.name) {
     this.name = this.options.name
   } else {
     this.name = require('./package.json').name
   }
-  this.hostname = (this.options.hostname) ? this.options.hostname : this.os.hostname()
+  if (this.options.hostname) {
+    this.hostname = this.options.hostname
+  } else {
+    let os = require('os')
+    this.hostname = os.hostname()
+  }
+  if (this.options.file) {
+    this.fs = require('fs')
+  }
   if (this.options.graylog) {
     this.graylog2 = require('graylog2')
     this.graylogger = new this.graylog2.graylog({ // eslint-disable-line new-cap
-- 
GitLab