Merge pull request #1789 from RafaelTaranto/fix/better-log-handling

LAM-1304 fix: better log handling for axios
This commit is contained in:
Rafael Taranto 2025-02-21 16:08:25 +00:00 committed by GitHub
commit a0b8b634fb

View file

@ -21,7 +21,18 @@ const logger = new winston.Logger({
}) })
], ],
rewriters: [ rewriters: [
(...[,, meta]) => meta instanceof Error ? { message: meta.message, stack: meta.stack, meta } : meta (...[,, meta]) => {
if (meta.isAxiosError) {
return {
message: meta.message,
status: meta.response?.status,
data: meta.response?.data,
url: meta.config?.url,
method: meta.config?.method
}
}
return meta instanceof Error ? { message: meta.message, stack: meta.stack, meta } : meta
}
], ],
exitOnError: false exitOnError: false
}) })