2018-06-05 18:48:14 +00:00
|
|
|
import * as plugins from './smartlog.plugins';
|
2018-01-28 03:31:06 +00:00
|
|
|
|
2018-03-03 12:57:55 +00:00
|
|
|
// interfaces
|
2018-07-08 20:30:21 +00:00
|
|
|
import { TEnvironment, ILogContext, TLogLevel, TRuntime } from '@pushrocks/smartlog-interfaces';
|
2018-01-28 03:31:06 +00:00
|
|
|
|
|
|
|
export class Smartlog {
|
2018-03-03 12:57:55 +00:00
|
|
|
private logContext: ILogContext;
|
2018-06-05 18:48:14 +00:00
|
|
|
private consoleEnabled: boolean;
|
|
|
|
private minimumLevel: TLogLevel;
|
|
|
|
private runtime: TRuntime;
|
2018-01-28 03:31:06 +00:00
|
|
|
// ============
|
|
|
|
// Logger Setup
|
|
|
|
// ============
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enables console logging
|
|
|
|
*/
|
2018-06-05 18:48:14 +00:00
|
|
|
enableConsole() {
|
|
|
|
this.consoleEnabled = true;
|
2018-01-28 03:31:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set a minimum serverity level to log
|
2018-01-28 03:31:44 +00:00
|
|
|
* @param levelArg
|
2018-01-28 03:31:06 +00:00
|
|
|
*/
|
2018-06-05 18:48:14 +00:00
|
|
|
level(levelArg: TLogLevel) {}
|
2018-01-28 03:31:06 +00:00
|
|
|
|
|
|
|
// =============
|
|
|
|
// log functions
|
|
|
|
// =============
|
|
|
|
/**
|
|
|
|
* log stuff
|
|
|
|
* @param logLevelArg
|
2018-01-28 03:31:44 +00:00
|
|
|
* @param logMessageArg
|
2018-01-28 03:31:06 +00:00
|
|
|
*/
|
2018-06-05 18:48:14 +00:00
|
|
|
log(logLevelArg: TLogLevel, logMessageArg: string) {}
|
2018-01-28 03:31:06 +00:00
|
|
|
|
2018-06-05 18:48:14 +00:00
|
|
|
silly(logMessageArg: string) {
|
|
|
|
this.log('silly', logMessageArg);
|
2018-01-28 03:31:06 +00:00
|
|
|
}
|
|
|
|
|
2018-06-05 18:48:14 +00:00
|
|
|
debug(logMessageArg) {
|
|
|
|
this.log('debug', logMessageArg);
|
2018-01-28 03:31:06 +00:00
|
|
|
}
|
|
|
|
|
2018-06-05 18:48:14 +00:00
|
|
|
info(logMessageArg: string) {
|
|
|
|
this.log('info', logMessageArg);
|
2018-01-28 03:31:06 +00:00
|
|
|
}
|
|
|
|
|
2018-06-05 18:48:14 +00:00
|
|
|
warn(logMessageArg) {
|
|
|
|
this.log('warn', logMessageArg);
|
2018-01-28 03:31:06 +00:00
|
|
|
}
|
|
|
|
|
2018-06-05 18:48:14 +00:00
|
|
|
error(logMessageArg) {
|
|
|
|
this.log('error', logMessageArg);
|
2018-01-28 03:31:06 +00:00
|
|
|
}
|
|
|
|
}
|