From 6d4694e0214a93eca34578a07fab2f481260f5e5 Mon Sep 17 00:00:00 2001 From: Samuel Berthe Date: Mon, 30 Oct 2023 10:40:02 +0100 Subject: [PATCH] feat: adding otel --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index f63c039..25c2bcd 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,20 @@ router.Run(":1234") // time=2023-04-10T14:00:0.000000Z level=INFO msg="Incoming request" status=200 method=GET path=/pong route=/pong ip=127.0.0.1 latency=25.5µs user-agent=curl/7.77.0 time=2023-04-10T14:00:00.000Z ``` +### OTEL + +```go +logger := slog.New(slog.NewTextHandler(os.Stdout, nil)) + +config := sloggin.Config{ + WithSpanID: true, + WithTraceID: true, +} + +router := chi.NewRouter() +router.Use(sloggin.NewWithConfig(logger, config)) +``` + ### Verbose ```go