fix(core): update
This commit is contained in:
parent
5d0056558a
commit
74e6bc7a3c
6
package-lock.json
generated
6
package-lock.json
generated
@ -168,9 +168,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/smartlog-interfaces": {
|
"@pushrocks/smartlog-interfaces": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog-interfaces/-/smartlog-interfaces-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog-interfaces/-/smartlog-interfaces-2.0.2.tgz",
|
||||||
"integrity": "sha512-c9onE52z/5fGX5uEvaI/rXbcC6n7PkLrNjehRM+6JsK7HIbdAzrgY1PGrqUfW0a03hSe03mFcggORID+fQI4tA=="
|
"integrity": "sha512-kJNQ/6kfljgtwebhoiD8WtRWfdVhOoE1nr8FoUJLlOjLphU8SPa42Hg6/yPkSTaGxWwDhk6PkMJl64O7HNjRUQ=="
|
||||||
},
|
},
|
||||||
"@pushrocks/smartpath": {
|
"@pushrocks/smartpath": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
|
@ -22,6 +22,6 @@
|
|||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.15.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartlog-interfaces": "^2.0.1"
|
"@pushrocks/smartlog-interfaces": "^2.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import * as plugins from './smartlog.plugins';
|
import * as plugins from './smartlog.plugins';
|
||||||
|
|
||||||
// interfaces
|
// 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';
|
import { LogRouter } from './smartlog.classes.logrouter';
|
||||||
|
|
||||||
@ -43,20 +43,26 @@ export class Smartlog {
|
|||||||
// log functions
|
// log functions
|
||||||
// =============
|
// =============
|
||||||
/**
|
/**
|
||||||
* log stuff
|
* main log method
|
||||||
* @param logLevelArg
|
* @param logLevelArg - the log level
|
||||||
* @param logMessageArg
|
* @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) {
|
if (this.consoleEnabled) {
|
||||||
console.log(`LOG: ${logLevelArg}: ${logMessageArg}`);
|
console.log(`LOG: ${logLevelArg}: ${logMessageArg}`);
|
||||||
}
|
}
|
||||||
this.logRouter.routeLog({
|
const logPackage: ILogPackage = {
|
||||||
|
timestamp: Date.now(),
|
||||||
type: 'log',
|
type: 'log',
|
||||||
context: this.logContext,
|
context: this.logContext,
|
||||||
level: logLevelArg,
|
level: logLevelArg,
|
||||||
message: logMessageArg
|
message: logMessageArg
|
||||||
});
|
};
|
||||||
|
if(logDataArg) {
|
||||||
|
logPackage.data = logDataArg;
|
||||||
|
}
|
||||||
|
this.logRouter.routeLog(logPackage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public increment(logLevelArg: TLogLevel, logMessageArg) {
|
public increment(logLevelArg: TLogLevel, logMessageArg) {
|
||||||
@ -64,6 +70,7 @@ export class Smartlog {
|
|||||||
console.log(`INCREMENT: ${logLevelArg}: ${logMessageArg}`);
|
console.log(`INCREMENT: ${logLevelArg}: ${logMessageArg}`);
|
||||||
}
|
}
|
||||||
this.logRouter.routeLog({
|
this.logRouter.routeLog({
|
||||||
|
timestamp: Date.now(),
|
||||||
type: 'increment',
|
type: 'increment',
|
||||||
context: this.logContext,
|
context: this.logContext,
|
||||||
level: logLevelArg,
|
level: logLevelArg,
|
||||||
|
Loading…
Reference in New Issue
Block a user