thessem / zap-prettyconsole

A structured logger with output designed to be read by humans. Implemented as a zap encoder.
MIT License
26 stars 5 forks source link

Problem with OpenTelemetry context #23

Open jayakornk opened 2 months ago

jayakornk commented 2 months ago

I'm using zap-prettyconsole along with OpenTelemetry for Gin and it injects tracing information into context. The problem I have is that when I log something, there will be this multiple line long object ([16]byte) printed out. Is there a way to help with this issue? Thanks for this awesome package btw.

api        | 6:22AM INFO > getting user email=john.doe@gmail.com
api        |   ↳ context=trace.SpanContext{
api        |               traceID: trace.TraceID{
api        |                 83,
api        |                 174,
api        |                 1,
api        |                 192,
api        |                 31,
api        |                 53,
api        |                 183,
api        |                 30,
api        |                 167,
api        |                 27,
api        |                 123,
api        |                 237,
api        |                 239,
api        |                 28,
api        |                 103,
api        |                 221,
api        |               },
api        |               spanID: trace.SpanID{
api        |                 103,
api        |                 160,
api        |                 54,
api        |                 157,
api        |                 26,
api        |                 211,
api        |                 100,
api        |                 36,
api        |               },
api        |               traceFlags: 1,
api        |               traceState: trace.TraceState{
api        |                 list: ([]trace.member)(nil),
api        |               },
api        |               remote: false,
api        |             }
thessem commented 2 months ago

Hey, apologies I haven't had time to look into this recently (I am currently moving). Some questions to set myself up when I do have a look at this though:

danielriddellsh commented 6 days ago

I am passing the context to be able to view it in Grafana using OTEL, which is advised by otelzap middleware. I there anyway i can omit this from the console. I am using

zap.Reflect("context", c.Request.Context()))