Replies: 1 comment
-
You can integrate trace to log. Here is some snippets. logger.Debug(msg, assembleFields(ctx, fields...)...)
// assembleFields format log fields
func assembleFields(ctx context.Context, fields ...Field) []Field {
fs := make([]Field, len(fields)+1)
fs[0] = String("trace_id", trace.TraceID(ctx))
copy(fs[1:], fields)
return fs
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to bind every log with a logId in a http service.
The logid save to the context.
Is there any good choice to do that ?
Beta Was this translation helpful? Give feedback.
All reactions