Skip to content

Commit

Permalink
error logs
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Aug 31, 2023
1 parent 166553a commit da9089c
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion frontend/packages/client-sdk/src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,26 @@ export function infoLog(msg: string, obj: Record<string, any> = {}) {
}

export function errLog(msg: string, error: any) {
console.log(`[ERROR] ${formatTime(new Date())} ${msg}`, error);
console.log(`[ERROR] ${formatTime(new Date())}`, msg);
console.log({
stack: error?.stack,
...(error?.config && {
config: {
headers: error.config.headers,
url: error.config.url,
data: error.config.data
}
}),
...(error?.body && {
body: error?.body
}),
...(error?.response && {
response: {
status: error.response.status,
statusText: error.response.statusText
}
})
});
}

export function warnLog(msg: string, obj: Record<string, any> = {}) {
Expand Down

0 comments on commit da9089c

Please sign in to comment.