From ecb7053e146c024b8172620b0f5f06078a1447d6 Mon Sep 17 00:00:00 2001 From: Domink Sigmund <sigmund.dominik@googlemail.com> Date: Fri, 28 Sep 2018 10:07:09 +0200 Subject: [PATCH] Use Package.json instead of basepath --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 4d68080..46fc6fa 100644 --- a/index.js +++ b/index.js @@ -1,9 +1,12 @@ function Log (options) { - this.path = require('path') this.fs = require('fs') this.os = require('os') this.options = options || {} - this.name = (this.options.name) ? this.options.name : this.path.basename(this.path.dirname(require.main.filename)) + 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.graylog) { this.graylog2 = require('graylog2') -- GitLab