fix(core): update

This commit is contained in:
Philipp Kunz 2024-05-18 01:15:16 +02:00
parent 459d3cc0e5
commit ff1192f09a
4 changed files with 5282 additions and 3239 deletions

View File

@ -30,12 +30,12 @@
"buildDocs": "tsdoc" "buildDocs": "tsdoc"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.25", "@git.zone/tsbuild": "^2.1.66",
"@gitzone/tsbundle": "^2.0.6", "@git.zone/tsbundle": "^2.0.8",
"@gitzone/tsrun": "^1.2.17", "@git.zone/tsrun": "^1.2.44",
"@gitzone/tstest": "^1.0.72", "@git.zone/tstest": "^1.0.77",
"@push.rocks/tapbundle": "^5.0.4", "@push.rocks/tapbundle": "^5.0.23",
"@types/node": "^18.6.1" "@types/node": "^20.12.12"
}, },
"dependencies": { "dependencies": {
"@push.rocks/isounique": "^1.0.4", "@push.rocks/isounique": "^1.0.4",

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartlog', name: '@push.rocks/smartlog',
version: '3.0.4', version: '3.0.5',
description: 'minimalistic distributed and extensible logging tool' description: 'A minimalistic, distributed, and extensible logging tool supporting centralized log management.'
} }

View File

@ -37,34 +37,35 @@ export class Smartlog implements plugins.smartlogInterfaces.ILogDestination {
public enableConsole(optionsArg?: { captureAll: boolean }) { public enableConsole(optionsArg?: { captureAll: boolean }) {
if (globalThis.process && optionsArg && optionsArg.captureAll) { if (globalThis.process && optionsArg && optionsArg.captureAll) {
const process = globalThis.process; const process = globalThis.process;
const write = process.stdout.write; const originalStdoutWrite = process.stdout.write.bind(process.stdout);
const originalStderrWrite = process.stderr.write.bind(process.stderr);
process.stdout.write = (...args: any) => { process.stdout.write = (...args: any) => {
const logString: string = args[0]; const logString: string = args[0];
if (!logString || typeof logString.startsWith !== 'function') { if (!logString || typeof logString !== 'string') {
// lets continue as planned // continue as planned
} else if (!logString.startsWith('LOG') && typeof logString === 'string') { return originalStdoutWrite(...args);
switch (true) { }
case logString.substr(0, 20).includes('Error:'):
this.log('error', logString); if (!logString.startsWith('LOG')) {
break; if (logString.includes('Error:')) {
default: this.log('error', logString);
this.log('info', logString); } else {
this.log('info', logString);
} }
return true; return true;
} }
// fileStream.write(args[0]);
write.apply(process.stdout, args); return originalStdoutWrite(...args);
return true;
}; };
process.stderr.write = (...args: any) => { process.stderr.write = (...args: any) => {
if (!args[0].startsWith('LOG')) { const logString: string = args[0];
this.log('error', args[0]); if (!logString || typeof logString !== 'string' || !logString.startsWith('LOG')) {
this.log('error', logString);
return true; return true;
} }
// fileStream.write(args[0]); return originalStderrWrite(...args);
write.apply(process.stderr, args);
return true;
}; };
} }
this.consoleEnabled = true; this.consoleEnabled = true;