Open doctorrokter opened 3 years ago
I was just looking to solve the same problem. It would be nice to be able to separate these concerns.
@holm for now I have a temp workaround in my project:
/node_modules
and simply disabled super.log
, super.error
etc calls inside SentryService
.npx patch-package @ntegral/nestjs-sentry
post-install
hook into package.json
file which will run patch every time.Definetely worth a try to fork the repo, get rid of inheritance and do a PR.
Rather than extending ConsoleLogger
class would be better to implement LoggerService
interface instead. In that case we still will have NestJS-like logging API.
And in addition we could provide custom logger class (or instance) during SentryModule initialization to let SentryService write custom logs if we want.
@ntegral @holm created PR for that FR, hope it looking not bad:
Awesome. Thanks for doing that. Added a few comments on the PR, just from my perspective, although of course this is not my library at all :)
Looks like by using the instance directly, it doesn't log into the console. So using: this.sentry.instance().captureMessage()
instead of this.sentry.log()
.
Hey!
In my Nest project I have a custom Logger implementation which is optimized for SumoLogic format. In case of errors I use my logger to print logs and
@ntegral/nestjs-sentry
to send error to Sentry. The problem is that lib by default also prints logs in default Nest format because ofSentryService extends ConsoleLogger
.I would to have an ability to
disable
that default behaviour in order to keep my logs clean and without duplication.Or, as another solution, would be great to have an ability to provide own custom logger to
@ntegral/nestjs-sentry
.What do you think about that?