From 44b5b474561992e52145fa9db5e168fa3153f4a9 Mon Sep 17 00:00:00 2001 From: plane000 Date: Tue, 30 Oct 2018 18:56:47 +0000 Subject: [PATCH] Logger now always logs verbosely to file --- src/commandmanagerspec.md | 3 +++ src/logger.js | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 src/commandmanagerspec.md diff --git a/src/commandmanagerspec.md b/src/commandmanagerspec.md new file mode 100644 index 0000000..8b7f994 --- /dev/null +++ b/src/commandmanagerspec.md @@ -0,0 +1,3 @@ +# Specification of command manager and modules + +- Ability to diff --git a/src/logger.js b/src/logger.js index 4691f83..7b2068d 100644 --- a/src/logger.js +++ b/src/logger.js @@ -46,25 +46,25 @@ export class Logger { static get WARN_LOGS() {return 3;} static database(message) { - if (LogLevel > 0) return; let d = moment().format(dateFormat); fs.appendFileSync(logPath, `[${d.toLocaleString()}] [${Dialect}] ${message} \n`); + if (LogLevel > 0) return; console.log('[' + d.toLocaleString() + '] [' + colours.magenta(Dialect) + '] ' + message); } static middleware(message) { - if (LogLevel > 0) return; let d = moment().format(dateFormat); fs.appendFileSync(logPath, `[${d.toLocaleString()}] [MIDDLEWARE] ${message} \n`); + if (LogLevel > 0) return; console.log('[' + d.toLocaleString() + '] [' + colours.blue('MIDDLEWARE') + '] ' + message); } static debug(message) { - if (LogLevel > 1) return; let d = moment().format(dateFormat); fs.appendFileSync(logPath, `[${d.toLocaleString()}] [DEBUG] ${message} \n`); + if (LogLevel > 1) return; console.log('[' + d.toLocaleString() + '] [' + colours.cyan('DEBUG') + '] ' + message); } @@ -77,17 +77,17 @@ export class Logger { } static info(message) { - if (LogLevel > 2) return; let d = moment().format(dateFormat); fs.appendFileSync(logPath, `[${d.toLocaleString()}] [INFO] ${message} \n`); + if (LogLevel > 2) return; console.log('[' + d.toLocaleString() + '] [' + colours.green('INFO') + '] ' + message); } static warn(message) { - if (LogLevel > 3) return; let d = moment().format(dateFormat); fs.appendFileSync(logPath, `[${d.toLocaleString()}] [WARN] ${message} \n`); + if (LogLevel > 3) return; console.log('[' + d.toLocaleString() + '] [' + colours.yellow('WARN') + '] ' + message); }