force show stack

This commit is contained in:
tamaina 2024-03-04 13:43:51 +00:00
parent 1f79cd1760
commit 7ce4a26970
2 changed files with 10 additions and 2 deletions

View file

@ -38,11 +38,13 @@ export default class Logger {
transport: !envOption.logJson ? { transport: !envOption.logJson ? {
target: 'pino-pretty', target: 'pino-pretty',
options: { options: {
colorize: true,
colorizeObjects: true,
levelFirst: false, levelFirst: false,
levelKey: 'level', levelKey: 'level',
timestampKey: 'time', timestampKey: 'time',
messageKey: 'message', messageKey: 'message',
errorLikeObjectKeys: ['e', 'err', 'error'], errorLikeObjectKeys: ['e', 'err', 'error', 'context.e', 'context.err', 'context.error'],
ignore: 'severity,pid,hostname,cluster,important', ignore: 'severity,pid,hostname,cluster,important',
messageFormat: '@{cluster} | {message}', messageFormat: '@{cluster} | {message}',
}, },

View file

@ -70,7 +70,13 @@ function getJobInfo(job: Bull.Job | undefined, increment = false): string {
function renderError(e: Error): any { function renderError(e: Error): any {
if (e) { // 何故かeがundefinedで来ることがある 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<string, any>),
};
} else { } else {
return { return {
stack: '?', stack: '?',