Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add %e error formatter #2726

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/logger/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
return v == null ? 'undefined' : v.toString()
}

// Add a formatter for stringifying Errors
debug.formatters.e = (v?: Error): string => {
return v == null ? 'undefined' : v.stack ?? v.message
}

Check warning on line 83 in packages/logger/src/index.ts

View check run for this annotation

Codecov / codecov/patch

packages/logger/src/index.ts#L82-L83

Added lines #L82 - L83 were not covered by tests

export interface Logger {
(formatter: any, ...args: any[]): void
error(formatter: any, ...args: any[]): void
Expand Down
Loading