-
Notifications
You must be signed in to change notification settings - Fork 558
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
Mask Error will always log an "Error Log". #3124
Comments
I agree, I am also annoyed by this logger which is on by default, and it is very hard to find the source since it has no prefix. We throw GraphQLWarnings which is a special error that we don't care about but this logger seems to log it any way with no possibility to opt out of it (?). I would propose to change this type of usages: this.logger.error(error) to errorCb(error) // or use event emitter where errorCb = (error: unknown) => {
logger.error("Yoga error", { error: error instanceof Error ? error.message : error })
} So we at least can opt out of spamming this in prod / staging envs without turning off Yoga logger completely, and also making it easier to find where the error is coming from in the source code. |
Describe the bug
When we use maskError to modify the error that we want to return to the client, it will always throw an error to the log.
Probably this change was introduced with this PR:
#2084
The idea is, that the maskError (earlier versions of GraphQLYoga called formatError) will format the error and based on a flag of our CustomError class (warning/error) we could on our own decide if we want to log an error or a warning.
Can this default logger.error be optional?
Your Example Website or App
GitHub
SandBox
Steps to Reproduce the Bug or Issue
Use MaskedError
Expected behavior
No Default Error Log
Screenshots or Videos
No response
Platform
GraphqlYoga 5.0.1
Additional context
No response
The text was updated successfully, but these errors were encountered: