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"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsbundle": "^2.0.6",
"@gitzone/tsrun": "^1.2.17",
"@gitzone/tstest": "^1.0.72",
"@push.rocks/tapbundle": "^5.0.4",
"@types/node": "^18.6.1"
"@git.zone/tsbuild": "^2.1.66",
"@git.zone/tsbundle": "^2.0.8",
"@git.zone/tsrun": "^1.2.44",
"@git.zone/tstest": "^1.0.77",
"@push.rocks/tapbundle": "^5.0.23",
"@types/node": "^20.12.12"
},
"dependencies": {
"@push.rocks/isounique": "^1.0.4",

8444
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartlog',
version: '3.0.4',
description: 'minimalistic distributed and extensible logging tool'
version: '3.0.5',
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 }) {
if (globalThis.process && optionsArg && optionsArg.captureAll) {
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) => {
const logString: string = args[0];
if (!logString || typeof logString.startsWith !== 'function') {
// lets continue as planned
} else if (!logString.startsWith('LOG') && typeof logString === 'string') {
switch (true) {
case logString.substr(0, 20).includes('Error:'):
if (!logString || typeof logString !== 'string') {
// continue as planned
return originalStdoutWrite(...args);
}
if (!logString.startsWith('LOG')) {
if (logString.includes('Error:')) {
this.log('error', logString);
break;
default:
} else {
this.log('info', logString);
}
return true;
}
// fileStream.write(args[0]);
write.apply(process.stdout, args);
return true;
return originalStdoutWrite(...args);
};
process.stderr.write = (...args: any) => {
if (!args[0].startsWith('LOG')) {
this.log('error', args[0]);
const logString: string = args[0];
if (!logString || typeof logString !== 'string' || !logString.startsWith('LOG')) {
this.log('error', logString);
return true;
}
// fileStream.write(args[0]);
write.apply(process.stderr, args);
return true;
return originalStderrWrite(...args);
};
}
this.consoleEnabled = true;