From f780b8281e821da7514c975e56dacf4e7ba9d346 Mon Sep 17 00:00:00 2001 From: Domink Sigmund <sigmund.dominik@googlemail.com> Date: Fri, 28 Sep 2018 10:11:36 +0200 Subject: [PATCH] Added tags FATAL and NOTICE --- README.md | 2 ++ index.js | 18 ++++++++++++++++++ samples/all-options.js | 2 ++ samples/log-to-file.js | 2 ++ samples/no-options.js | 4 +++- 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 811d0bb..b196ff7 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,10 @@ Note: The options Part may be omitted, as all parts are optional, but using the ### Methods * `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 46fc6fa..096a6a0 100644 --- a/index.js +++ b/index.js @@ -19,6 +19,12 @@ function Log (options) { this.info = function (message) { this.log('INFO', message) } + this.notice = function (message) { + this.log('NOTICE', message) + } + this.fatal = function (message) { + this.log('FATAL', message) + } this.warn = function (message) { this.log('WARN', message) } @@ -34,12 +40,18 @@ function Log (options) { case 'INFO': console.log(msg) break + case 'NOTICE': + console.log(msg) + break case 'WARN': console.warn(msg) break case 'ERROR': console.error(msg) break + case 'FATAL': + console.error(msg) + break case 'DEBUG': console.log(msg) break @@ -54,12 +66,18 @@ function Log (options) { case 'INFO': this.graylogger.info(message) break + case 'NOTICE': + this.graylogger.notice(message) + break case 'WARN': this.graylogger.warning(message) break case 'ERROR': this.graylogger.error(message) break + case 'FATAL': + this.graylogger.critical(message) + break case 'DEBUG': this.graylogger.debug(message) break diff --git a/samples/all-options.js b/samples/all-options.js index 86411c5..aec3a0e 100644 --- a/samples/all-options.js +++ b/samples/all-options.js @@ -6,6 +6,8 @@ let log = new Log({ }) 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') \ No newline at end of file diff --git a/samples/log-to-file.js b/samples/log-to-file.js index 8f35981..e5abb11 100644 --- a/samples/log-to-file.js +++ b/samples/log-to-file.js @@ -6,6 +6,8 @@ let log = new Log({ }) 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') \ No newline at end of file diff --git a/samples/no-options.js b/samples/no-options.js index fe28ba6..d53c2b3 100644 --- a/samples/no-options.js +++ b/samples/no-options.js @@ -3,6 +3,8 @@ const Log = require('../index.js') let log = new Log() 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.debug('This is a Debug Message') \ No newline at end of file +log.debug('This is a Debug Message') +log.fatal('This is a Fatal Message') -- GitLab