diff --git a/packages/backend/src/logger.ts b/packages/backend/src/logger.ts index 34b5368516..fccda73bf0 100644 --- a/packages/backend/src/logger.ts +++ b/packages/backend/src/logger.ts @@ -38,11 +38,13 @@ export default class Logger { transport: !envOption.logJson ? { target: 'pino-pretty', options: { + colorize: true, + colorizeObjects: true, levelFirst: false, levelKey: 'level', timestampKey: 'time', messageKey: 'message', - errorLikeObjectKeys: ['e', 'err', 'error'], + errorLikeObjectKeys: ['e', 'err', 'error', 'context.e', 'context.err', 'context.error'], ignore: 'severity,pid,hostname,cluster,important', messageFormat: '@{cluster} | {message}', }, diff --git a/packages/backend/src/queue/QueueProcessorService.ts b/packages/backend/src/queue/QueueProcessorService.ts index 16c5d0f365..dd151af402 100644 --- a/packages/backend/src/queue/QueueProcessorService.ts +++ b/packages/backend/src/queue/QueueProcessorService.ts @@ -70,7 +70,13 @@ function getJobInfo(job: Bull.Job | undefined, increment = false): string { function renderError(e: Error): any { if (e) { // 何故かeがundefinedで来ることがある - return e; + return { + ...Object.getOwnPropertyNames(e).reduce((acc, key) => { + //@ts-expect-error Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Error'. + acc[key] = e[key]; + return acc; + }, {} as Record), + }; } else { return { stack: '?',