removed useless package and added middleware logger

This commit is contained in:
plane000
2018-08-27 18:00:31 +01:00
parent 1ac8ea9b96
commit e80a1c1b6e
5 changed files with 17 additions and 10 deletions

View File

@@ -8,7 +8,6 @@
"colors": "^1.3.1",
"express": "^4.16.3",
"json-stringify-safe": "^5.0.1",
"mysql": "^2.16.0",
"regenerator-runtime": "^0.12.1",
"sequelize": "^4.38.0",
"sqlite3": "^4.0.2"

View File

@@ -14,12 +14,13 @@ async function init() {
await Server.start();
await Router.initEndpoints();
// Logger.database('Database Log');
// Logger.middleware('GET request to /');
// Logger.debug('Debug mode enabled');
// Logger.info('Informatic log');
// Logger.warn('Warning');
// Logger.error('An error has occured');
// Logger.panic('A fatal error has occured, exiting');
}
// Logger.database('Database Log');
// Logger.debug('Debug mode enabled');
// Logger.info('Informatic log');
// Logger.warn('Warning');
// Logger.error('An error has occured');
// Logger.panic('A fatal error has occured, exiting');

View File

@@ -5,7 +5,7 @@ import {Logger} from '../models/logger';
export class MiddleWare {
static analytics(req, res, next) {
// TODO: Send data such as IP to an anyaltitics model
Logger.info(`${req.method} request to ${req.url}`)
Logger.middleware(`${req.method} request to ${req.url}`)
next();
}

View File

@@ -10,7 +10,7 @@ let auth;
let session;
export class BaseDatabase {
static get Connection() {return connection}
static get Connection() {return connection;}
static async init() {
Logger.info('Connecting to SQLite Database');

View File

@@ -18,6 +18,13 @@ export class Logger {
+ colours.magenta('SQLITE') + '] ' + message);
}
static middleware(message) {
if (LogLevel > 0) return;
let d = new Date();
console.log('[' + d.toLocaleString() + '] ['
+ colours.blue('HTTP-MIDDLEWARE') + '] ' + message);
}
static debug(message) {
if (LogLevel > 1) return;
let d = new Date();