fix(core): update

This commit is contained in:
Philipp Kunz 2018-11-04 18:21:18 +01:00
parent 5d0056558a
commit 74e6bc7a3c
3 changed files with 18 additions and 11 deletions

6
package-lock.json generated
View File

@ -168,9 +168,9 @@
}
},
"@pushrocks/smartlog-interfaces": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog-interfaces/-/smartlog-interfaces-2.0.1.tgz",
"integrity": "sha512-c9onE52z/5fGX5uEvaI/rXbcC6n7PkLrNjehRM+6JsK7HIbdAzrgY1PGrqUfW0a03hSe03mFcggORID+fQI4tA=="
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog-interfaces/-/smartlog-interfaces-2.0.2.tgz",
"integrity": "sha512-kJNQ/6kfljgtwebhoiD8WtRWfdVhOoE1nr8FoUJLlOjLphU8SPa42Hg6/yPkSTaGxWwDhk6PkMJl64O7HNjRUQ=="
},
"@pushrocks/smartpath": {
"version": "4.0.1",

View File

@ -22,6 +22,6 @@
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@pushrocks/smartlog-interfaces": "^2.0.1"
"@pushrocks/smartlog-interfaces": "^2.0.2"
}
}

View File

@ -1,7 +1,7 @@
import * as plugins from './smartlog.plugins';
// interfaces
import { TLogType, TEnvironment, ILogContext, TLogLevel, TRuntime, ILogDestination } from '@pushrocks/smartlog-interfaces';
import { TLogType, TEnvironment, ILogContext, TLogLevel, TRuntime, ILogDestination, ILogPackage } from '@pushrocks/smartlog-interfaces';
import { LogRouter } from './smartlog.classes.logrouter';
@ -43,20 +43,26 @@ export class Smartlog {
// log functions
// =============
/**
* log stuff
* @param logLevelArg
* @param logMessageArg
* main log method
* @param logLevelArg - the log level
* @param logMessageArg - the log message
* @param logDataArg - any additional log data
*/
public log(logLevelArg: TLogLevel, logMessageArg: string) {
public log(logLevelArg: TLogLevel, logMessageArg: string, logDataArg?: any) {
if (this.consoleEnabled) {
console.log(`LOG: ${logLevelArg}: ${logMessageArg}`);
}
this.logRouter.routeLog({
const logPackage: ILogPackage = {
timestamp: Date.now(),
type: 'log',
context: this.logContext,
level: logLevelArg,
message: logMessageArg
});
};
if(logDataArg) {
logPackage.data = logDataArg;
}
this.logRouter.routeLog(logPackage);
}
public increment(logLevelArg: TLogLevel, logMessageArg) {
@ -64,6 +70,7 @@ export class Smartlog {
console.log(`INCREMENT: ${logLevelArg}: ${logMessageArg}`);
}
this.logRouter.routeLog({
timestamp: Date.now(),
type: 'increment',
context: this.logContext,
level: logLevelArg,