diff --git a/index.js b/index.js index e0aad2e94504b361be72ae0aaf7f249a698b72e1..b1726bbbeda7933e959d359343dd39c2bd9ff7f3 100644 --- a/index.js +++ b/index.js @@ -71,17 +71,17 @@ function Log (options) { } this.log = function (tag, message, tags) { let tadd = '' - if (typeof tags !== 'undefined' && typeof tags === 'string') { + if (typeof tags !== 'undefined') { if (Array.isArray(tags)) { tadd = ' #' + tags.join(' #') - } else if (tags.includes(' ')) { + } else if (typeof tags === 'string' && tags.includes(' ')) { tadd = ' #' + tags.split(' ').join(' #') - } else if (tags.includes(',')) { + } else if (typeof tags === 'string' && tags.includes(',')) { tadd = ' #' + tags.split(',').join(' #') } else { tadd = ' #' + tags } - } else { tadd = tags} + } let msg = this.getDate() + '\t' + this.hostname + '\t' + this.name + '\t' + tag + '\t' + message + tadd switch (tag) {