diff --git a/README.md b/README.md index 8fe141d7b89e633c6540ea2b88f0dab27e8ab68c..0c05deda10330a5d00cd76dc4030ad80b0db0c70 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # log.js A real simple logger application. -May Optional Log to A File and / or a Graylog-Server +May Optional Log to A File. ## Installation @@ -16,23 +16,12 @@ Note: The options Part may be omitted, as all parts are optional, but using the ### Methods - -* `log.info('This is an Information' [, tags])` -* `log.notice('This is a Notice' [, tags])` -* `log.warn('This is a Warning' [, tags])` -* `log.error('This is an Error' [, tags])` -* `log.fatal('This is a Fatal Message' [, tags])` -* `log.debug('This is a Debug Message' [, tags])` - -You may add Tags to a logline. These Tags may take the following forms: - -* string = 'tag' -* string, seperated by whitespace = 'tag1 tag2 tag3' -* string, seperated by comma = 'tag1,tag2,tag3' -* array of strings = ['tag1', 'tag2', 'tag3'] - -These Tags will be added to the line with octothorpes added. -(#tag1 #tag2 #tag3) +* `log.info('This is an Information' )` +* `log.notice('This is a Notice' )` +* `log.warn('This is a Warning' )` +* `log.error('This is an Error' )` +* `log.fatal('This is a Fatal Message' )` +* `log.debug('This is a Debug Message' )` ### Options diff --git a/index.js b/index.js index 9f795822c2de4c77394647ee4cd641ded571b7a1..443cff9bf03c5f9945a5ad41763dd77499cab25a 100644 --- a/index.js +++ b/index.js @@ -41,62 +41,50 @@ function Log (options) { } } } - this.info = function (message, tags) { + this.info = function (message) { if (this.loglevel >= this.levels.INFO) { - return this.log('INFO', message, tags) + return this.log('INFO', message) } else { return '' } } - this.notice = function (message, tags) { + this.notice = function (message) { if (this.loglevel >= this.levels.NOTICE) { - return this.log('NOTICE', message, tags) + return this.log('NOTICE', message) } else { return '' } } - this.fatal = function (message, tags) { + this.fatal = function (message) { if (this.loglevel >= this.levels.FATAL) { - return this.log('FATAL', message, tags) + return this.log('FATAL', message) } else { return '' } } - this.warn = function (message, tags) { + this.warn = function (message) { if (this.loglevel >= this.levels.WARN) { - return this.log('WARN', message, tags) + return this.log('WARN', message) } else { return '' } } - this.error = function (message, tags) { + this.error = function (message) { if (this.loglevel >= this.levels.ERROR) { - return this.log('ERROR', message, tags) + return this.log('ERROR', message) } else { return '' } } - this.debug = function (message, tags) { + this.debug = function (message) { if (this.loglevel >= this.levels.DEBUG) { - return this.log('DEBUG', message, tags) + return this.log('DEBUG', message) } else { return '' } } - this.log = function (tag, message, tags) { - let tadd = '' - if (typeof tags !== 'undefined') { - if (Array.isArray(tags)) { - tadd = ' #' + tags.join(' #') - } else if (tags.includes(' ')) { - tadd = ' #' + tags.split(' ').join(' #') - } else if (tags.includes(',')) { - tadd = ' #' + tags.split(',').join(' #') - } else { - tadd = ' #' + tags - } - } - let msg = this.getDate() + '\t' + this.hostname + '\t' + this.name + '\t' + tag + '\t' + message + tadd + this.log = function (tag, message) { + let msg = this.getDate() + '\t' + this.hostname + '\t' + this.name + '\t' + tag + '\t' + message switch (tag) { case 'INFO': console.info(msg) diff --git a/package.json b/package.json index 8b85ad7a506ea53c958c940d7cb0f226857a4625..23eeb22fbcd5d6a36965b963c71780f4ddcb9c60 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lib-log", - "version": "1.1.0", + "version": "2.0.0", "description": "A simple Logger with Options!", "main": "index.js", "scripts": {