From 57b0c7fbb6c607f23e1ec78bbd8719f58396dd37 Mon Sep 17 00:00:00 2001 From: Yusef Mohamadi Date: Wed, 8 Nov 2023 16:37:54 +0100 Subject: [PATCH] tweak doc --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2725bef..ce21e44 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Zax is a library that adds context to [Zap Logger](https://github.com/uber-go/za ### Usage: To add something to the context and carry it along, simply use zap.Set: - ctx = zax.Set(ctx, logger, []zap.Field{zap.String("trace_id", "my-trace-id")}) + ctx = zax.Set(ctx, logger, zap.String("trace_id", "my-trace-id")) To retrieve a logger with the contexted fields, use zax.Get: @@ -41,9 +41,9 @@ func main() { logger, _ := zap.NewProduction() ctx := context.Background() s := NewServiceA(logger) - ctx = zax.Set(ctx, logger, zap.String("trace_id", "my-trace-id")) - // and if you want to add multiple of them at once - //ctx = zax.Set(ctx, logger, []zap.Field{zap.String("trace_id", "my-trace-id"),zap.String("span_id", "my-span-id")}) + ctx = zax.Set(ctx, logger, zap.String("trace_id", "my-trace-id")) + // and if you want to add multiple of them at once + //ctx = zax.Set(ctx, logger, []zap.Field{zap.String("trace_id", "my-trace-id"),zap.String("span_id", "my-span-id")}) s.funcA(ctx) }