-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: structured logger #36199
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: structured logger #36199
Conversation
| return problems.clearProblems(); | ||
| } | ||
|
|
||
| export function logFatal<C extends FatalCode, A extends AdditionalFieldsMap[C]>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to make this fit into logger.fatal() but I'm open to that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type came from ChatGPT. I tried using the Exact from type-fest instead, but it wasn't the same
secustor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm for this, but maybe there should a default handler for errorMessage, if error has been provided as a field.
So that errorMessage: err.message is the default, but can be overwritten.
|
So make err:Error an optional field for all? |
viceice
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
failed CI checks
| export async function generateErrors(dist: string): Promise<void> { | ||
| const errorFile = 'errors.md'; | ||
| let errorFileContents = await readFile(`docs/usage/${errorFile}`); | ||
| const errorTypes = ['fatal'] as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about the error type? 🤔
| const errorTypes = ['fatal'] as const; | ||
| for (const errorType of errorTypes) { | ||
| const capitalizedType = | ||
| errorType.charAt(0).toUpperCase() + errorType.slice(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't we have a util function already for this? 🤔
|
Hi there, We're closing this PR due to inactivity, but we are happy for you, or others, to finish the PR if time allows. Thanks, the Renovate team |
Changes
Adds new typed logging for fatal messages
Context
I would like to consolidate and strongly type all warn, error and fatal messages
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via: