feat(server): log http exceptions (#9996)

This commit is contained in:
Jason Rasmussen
2024-06-05 17:07:47 -04:00
committed by GitHub
parent ce985ef8f8
commit 0f976edf96
9 changed files with 91 additions and 18 deletions

View File

@@ -30,17 +30,20 @@ export class LoggerRepository extends ConsoleLogger implements ILoggerRepository
}
protected formatContext(context: string): string {
let formattedContext = super.formatContext(context);
let prefix = LoggerRepository.appName || '';
if (context) {
prefix += (prefix ? ':' : '') + context;
}
const correlationId = this.cls?.getId();
if (correlationId && this.isLevelEnabled(LogLevel.VERBOSE)) {
formattedContext += `[${correlationId}] `;
if (correlationId) {
prefix += `~${correlationId}`;
}
if (LoggerRepository.appName) {
formattedContext = LogColor.blue(`[${LoggerRepository.appName}] `) + formattedContext;
if (!prefix) {
return '';
}
return formattedContext;
return LogColor.yellow(`[${prefix}]`) + ' ';
}
}