From cbba1dc18f51eca57511cf41d915357ddebf4704 Mon Sep 17 00:00:00 2001 From: Emilio Garcia Date: Fri, 19 Apr 2024 10:47:26 -0400 Subject: [PATCH] Context Driven Handler Example Slog Support for context driven handler behavior in slog --- v3/integrations/logcontext-v2/nrslog/example/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v3/integrations/logcontext-v2/nrslog/example/main.go b/v3/integrations/logcontext-v2/nrslog/example/main.go index 57a7d11d1..8126c03ec 100644 --- a/v3/integrations/logcontext-v2/nrslog/example/main.go +++ b/v3/integrations/logcontext-v2/nrslog/example/main.go @@ -24,8 +24,8 @@ func main() { log.Info("I am a log message") txn := app.StartTransaction("example transaction") - txnLogger := nrslog.WithTransaction(txn, log) - txnLogger.Info("I am a log inside a transaction") + txnCtx := newrelic.NewContext(context.Background(), txn) + txnLogger.InfoContext(txnCtx, "I am a log inside a transaction") // pretend to do some work time.Sleep(500 * time.Millisecond)