Skip to content

Commit

Permalink
chore: change http error log format
Browse files Browse the repository at this point in the history
  • Loading branch information
zAlweNy26 committed Jul 27, 2024
1 parent d855225 commit 20f2f12
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ export function httpLogger(options?: LogesticOptions) {
const baseUrl = url.substring(catPaths.baseUrl.length - 1)
const dateTime = chalk.gray(format(datetime, 'dd/MM/yyyy HH:mm:ss'))
const methodPath = chalk.red(`${method} ${decodeURIComponent(baseUrl)}`)
const errorCode = chalk.red(`${err.status} - ${err.message} - ${err.cause}`)
return `${dateTime} ${methodPath} ${errorCode}`
const errorCode = chalk.bgRed(`[${err.status} - ${err.message}]`)
const errorText = `${errorCode} ${chalk.red(err.cause)}`
return `${dateTime} ${methodPath}\n${errorText}`
},
})
}

0 comments on commit 20f2f12

Please sign in to comment.