fix: better log handling for axios
This commit is contained in:
parent
e4c4dae293
commit
48fc1e38cd
1 changed files with 12 additions and 1 deletions
|
|
@ -21,7 +21,18 @@ const logger = new winston.Logger({
|
|||
})
|
||||
],
|
||||
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
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue