Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
♻️ Use pino symbols without a type cast
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Vlasák committed Sep 22, 2020
1 parent cb4c1c9 commit c56caf7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ export const extendSentry = (logger: Cosmas, options: { sentry: string | true; s
sentry.init({ dsn: options.sentry });
}

const originalWrite = logger[(pino as any).symbols.streamSym].write; // TODO: update pino types with symbols
const originalWrite = logger[pino.symbols.streamSym].write;
// unfortunately, this is the only place in pino, we can hook onto, where we can be sure all
// the hooks, formatters and serializers are already applied
logger[(pino as any).symbols.streamSym].write = function (s: string) {
logger[pino.symbols.streamSym].write = function (s: string) {
originalWrite.call(this, s);
const obj = JSON.parse(s);
if (obj.level < (options.sentryLevel || levels.warn)) return;
Expand Down

0 comments on commit c56caf7

Please sign in to comment.