fix(core): update

This commit is contained in:
Philipp Kunz 2020-06-11 10:11:37 +00:00
parent 7d72b24770
commit 1cc75afc32
4 changed files with 22 additions and 12 deletions

12
package-lock.json generated
View File

@ -1188,9 +1188,9 @@
} }
}, },
"@pushrocks/smartlog-interfaces": { "@pushrocks/smartlog-interfaces": {
"version": "2.0.18", "version": "2.0.19",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog-interfaces/-/smartlog-interfaces-2.0.18.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog-interfaces/-/smartlog-interfaces-2.0.19.tgz",
"integrity": "sha512-2CUGyTJsf4/pTqJqu7FUCsB/I5Vsz+DwpwPG/2sQk5VxT9oX8AUWtz2BspLrGNlMg7wTJR79f4yA6Dk5xQ6qFQ==", "integrity": "sha512-H4iQm1ZRSxnBTUy58WQ3VY0kFLHTm0eXrZX0+UPptgBQoZ8DZZow+bbY7yo0s4+q1EN0NqpJWVRkOQmZJ0asJg==",
"requires": { "requires": {
"@apiglobal/typedrequest-interfaces": "^1.0.13" "@apiglobal/typedrequest-interfaces": "^1.0.13"
} }
@ -1599,9 +1599,9 @@
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
}, },
"@types/node": { "@types/node": {
"version": "14.0.11", "version": "14.0.13",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.0.11.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.0.13.tgz",
"integrity": "sha512-lCvvI24L21ZVeIiyIUHZ5Oflv1hhHQ5E1S25IRlKIXaRkVgmXpJMI3wUJkmym2bTbCe+WoIibQnMVAU3FguaOg==" "integrity": "sha512-rouEWBImiRaSJsVA+ITTFM6ZxibuAlTuNOCyxVbwreu6k6+ujs7DfnU9o+PShFhET78pMBl3eH+AGSI5eOTkPA=="
}, },
"@types/portscanner": { "@types/portscanner": {
"version": "2.1.0", "version": "2.1.0",

View File

@ -25,14 +25,14 @@
"@gitzone/tsrun": "^1.2.12", "@gitzone/tsrun": "^1.2.12",
"@gitzone/tstest": "^1.0.33", "@gitzone/tstest": "^1.0.33",
"@pushrocks/tapbundle": "^3.2.1", "@pushrocks/tapbundle": "^3.2.1",
"@types/node": "^14.0.11", "@types/node": "^14.0.13",
"tslint": "^6.1.2", "tslint": "^6.1.2",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@gitzone/tsbundle": "^1.0.69", "@gitzone/tsbundle": "^1.0.69",
"@pushrocks/isounique": "^1.0.4", "@pushrocks/isounique": "^1.0.4",
"@pushrocks/smartlog-interfaces": "^2.0.18" "@pushrocks/smartlog-interfaces": "^2.0.19"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",

View File

@ -15,9 +15,9 @@ export class LogRouter {
} }
// routes the log according to added logDestinations // routes the log according to added logDestinations
routeLog(logPackageArg: ILogPackage) { public async routeLog(logPackageArg: ILogPackage) {
for (const logDestination of this.logDestinations) { for (const logDestination of this.logDestinations) {
logDestination.handleLog(logPackageArg); await logDestination.handleLog(logPackageArg);
} }
} }
} }

View File

@ -50,6 +50,16 @@ export class Smartlog implements plugins.smartlogInterfaces.ILogDestination {
write.apply(process.stdout, args); write.apply(process.stdout, args);
return true; return true;
}; };
process.stderr.write = (...args) => {
if (!args[0].startsWith('LOG')) {
this.log('info', args[0]);
return;
}
// fileStream.write(args[0]);
write.apply(process.stderr, args);
return true;
};
} }
this.consoleEnabled = true; this.consoleEnabled = true;
} }
@ -64,7 +74,7 @@ export class Smartlog implements plugins.smartlogInterfaces.ILogDestination {
* @param logDataArg - any additional log data * @param logDataArg - any additional log data
* @param correlationArg - info about corrleations * @param correlationArg - info about corrleations
*/ */
public log( public async log(
logLevelArg: plugins.smartlogInterfaces.TLogLevel, logLevelArg: plugins.smartlogInterfaces.TLogLevel,
logMessageArg: string, logMessageArg: string,
logDataArg?: any, logDataArg?: any,
@ -94,7 +104,7 @@ export class Smartlog implements plugins.smartlogInterfaces.ILogDestination {
if (logDataArg) { if (logDataArg) {
logPackage.data = logDataArg; logPackage.data = logDataArg;
} }
this.logRouter.routeLog(logPackage); await this.logRouter.routeLog(logPackage);
} }
public increment( public increment(