Skip to content

Commit

Permalink
Remove custom logger tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
wcalderipe committed Oct 30, 2024
1 parent da2edd4 commit 43b821c
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions packages/nestjs-shared/src/lib/module/logger/winston.logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { stringify } from '@narval/policy-engine-shared'
import { context, trace } from '@opentelemetry/api'
import winston from 'winston'
import { redact } from './logger.util'

Expand All @@ -26,24 +25,11 @@ const pretty = (info: winston.Logform.TransformableInfo) => {
return `${info.timestamp} ${getLevelColor(level)}[${level.toUpperCase()}]\x1b[0m: ${message}\n${stringify(context, 2)}`
}

const tracing = winston.format((info) => {
const span = trace.getSpan(context.active())

if (span) {
const spanContext = span.spanContext()

info.spanId = spanContext.spanId
info.traceId = spanContext.traceId
}

return info
})

const redacting = winston.format((info) => {
return redact(info)
})

const BASE_FORMAT = [winston.format.timestamp(), winston.format.json(), tracing(), redacting()]
const BASE_FORMAT = [winston.format.timestamp(), winston.format.json(), redacting()]

const production = winston.format.combine(...BASE_FORMAT, winston.format.printf(stringify))

Expand Down

0 comments on commit 43b821c

Please sign in to comment.