refactor(server): auto print full stack on logger.error (#10161)

This commit is contained in:
fengmk2
2025-02-13 11:49:41 +00:00
parent 899b1d60e0
commit 3ff721abe8
5 changed files with 113 additions and 21 deletions

View File

@@ -1,17 +1,13 @@
import { WinstonLogger } from 'nest-winston';
import { AFFiNELogger as RawAFFiNELogger } from '../../../base/logger';
export class AFFiNELogger extends WinstonLogger {
override error(
message: any,
trace?: Error | string | unknown,
stackOrError?: Error | string | unknown,
context?: string
) {
if (trace && trace instanceof Error) {
super.error(message, trace.stack, context);
} else if (typeof trace === 'string' || trace === undefined) {
super.error(message, trace, context);
} else {
super.error(message, undefined, context);
}
RawAFFiNELogger.prototype.error.call(this, message, stackOrError, context);
}
}