You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 or whatever you call it can be a config option that by default is
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: