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
Unstoppable console log message when misconfigured #566
Comments
Hi @chadjaros , I reproduced your issue with the snippet: const errors = new ErrorReporting(
{
projectId: 'trash',
reportMode: 'always',
}
);
// This line (A) writes the error message to error-reporting api
errors.report("this is an error message", (err) => {
if (err) {
// This line (B) specifies how your code handles any issues with calling the error-reporting api
console.log('Failed to report error', err);
}
}); Line B is where you configured the library to log any failed error-reporting API calls to your Setting logLevel to 0 only controls what logs are written (via line A) & sent to the error-reporting API. It has nothing to do with |
Thanks for looking at this @nicoleczhu The problem is that if you comment out the line |
Ah yes, I was able to reproduce this. Yes, this library should let users reconfigure where library-originated errors are emitted. Marking this as a feature request. Thank you for making us aware of this. There's actually a WIP here: https://github.com/feywind/node-debug-logging |
I really like the pattern that SLF4J uses, and a similar thing can be built in JS. We've built a package like this where I work and it's very flexible. Unfortunately nothing like this is open source and widely adopted in JS/TS yet. |
Reopening #525
The above ticket was closed without addressing the issue described in the ticket.
tl/dr; The error management and logging facilities don't actually allow you to disable logging messages to console.log.
client library
don't think so
Yes, but was told to log the issue here anyways.
Environment details
@google-cloud/error-reporting
version: ^2.0.0Steps to reproduce
Observe the following long error message is printed to stdout even though logLevel is set to 0 and a callback is provided. The callback configured above results in printing a subset of the following error a second time.
I would assume that either utilizing a callback or setting the logLevel to 0 would prevent this error from being printed. My app logs using JSON format, and when this message is printed it clutters the logs with a bunch of statements that aren't independently useful.
The text was updated successfully, but these errors were encountered: