Skip to content

Commit

Permalink
Update logger.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Apr 27, 2024
1 parent 07ac70d commit 72539c0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api/src/common/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ export const info = (message: string, obj?: any) => {
}
}

export const error = (message: string, err?: unknown) => {
if (err instanceof Error) {
logger.error(`${message} ${err.message}`) // ${err.stack}
export const error = (message: string, obj?: unknown) => {
if (obj instanceof Error) {
logger.error(`${message} ${obj.message}`) // ${err.stack}
} else if (obj) {
logger.error(`${message} ${JSON.stringify(obj)}`)
} else {
logger.error(message)
}
Expand Down

0 comments on commit 72539c0

Please sign in to comment.