nestjs-sentry
nestjs-sentry copied to clipboard
Logger implementation should log non-error messages as breadcrumbs.
The default behaviour of any Sentry SDK is to capture non-error logs as breadcrumbs and send them all together as soon as an error happens.
I see SentryService extends Logger but the methods log, debug, verbose and warn are actually calling captureMessage and I think they should be storing that log as a breadcrumb in the current scope.
This way, replacing the default NestJS logger with this library would be a no-brainer and we'd get proper log messages before an exception on Sentry.
Will add this to the backlog thanks
Would you accept a PR? I've already forked and implemented it.
Thanks.. I'll review it @empz
This feature as been added in the latest version 3.0.7
This feature as been added in the latest version 3.0.7
I see you've added a parameter to SentryService to log a non-error message as breadcrumb. Still this is not optimal as I'm using the SentryService as the default logger and I need to go and add that extra argument on each log call....
I understand you don't want to set this as the default (although it makes way more sense this way) to avoid breaking changes, but wouldn't be a global config much easier to set up?
Somewhere in the forRoot config we should have the option to say "store non-error messages as breadcrumbs".
@dg-eparizzi Created a PR here, but I did it in the forked version from travelerdev. I think this would fit your use case. I can also create a PR here if relevant