-
Notifications
You must be signed in to change notification settings - Fork 38
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
Errors are not grouped correctly #31
Comments
After some digging in the code, I understand that there is no stack trace at first as we provide a message and not an error object. I would expect the lib to just forward the message though, instead of trying to generate a real error object with a useless stack trace... |
Resolved in #40 |
thanks! |
It's was solved? I still getting useless node_modules traces when I use logger.error |
Should work if you're on the current version and pass an |
@orengor can you give an example how it should be passed correcly? |
@trymbill , @jadesym and everyone who comes here with a question about how to log errors properly using this transport and Winston with node (nests) in general: try {
return await this.userService.profileUpdate(
authPayload._id,
updateProfileDto,
);
} catch (e) {
this.logger.error(e);
} If you want to show and log with more details you should pass your own object into the logger, instead of splitting the error into parameters, so yor detailed error will looks like: this.logger.debug({
message: 'Object stored successfully',
context: this.constructor.name,
object,
}); Using this style of logging, you will receive properly handled errors on sentry, and properly handled errors in your other transport. Example of properly logger error here: |
Hi,
We have trouble on Sentry's side because errors alerting is not working as expected. As it turns out, Sentry is grouping errors according to stack trace, and the stack trace is always the same regardless of where the error originated in our code.
For example, if we call
logger.error('Some message', { error: err, requestId });
in line 12 of codefile.js, we want errors to be location according to that location, and instead we currently have/app/node_modules/winston-transport-sentry-node/dist/transport.js in SentryTransport.log at line 72:64
for all errorsIs there a way to preserve the stack trace from the location
logger.error
was called instead of overriding it ?The text was updated successfully, but these errors were encountered: