File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ require (
9696 github.com/puzpuzpuz/xsync/v3 v3.5.1 // indirect
9797 github.com/quic-go/qpack v0.6.0 // indirect
9898 github.com/quic-go/quic-go v0.59.0 // indirect
99+ github.com/remychantenay/slog-otel v1.3.4 // indirect
99100 github.com/rs/zerolog v1.26.1 // indirect
100101 github.com/russross/blackfriday/v2 v2.0.1 // indirect
101102 github.com/samber/slog-common v0.19.0 // indirect
Original file line number Diff line number Diff line change @@ -215,6 +215,8 @@ github.com/quic-go/quic-go v0.59.0 h1:OLJkp1Mlm/aS7dpKgTc6cnpynnD2Xg7C1pwL6vy/SA
215215github.com/quic-go/quic-go v0.59.0 /go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU =
216216github.com/raf555/salome v0.0.0-20260217024826-a3f86dff4827 h1:Nu5jXZHarRG64nQqNZJajm9/3DNEYrh0ap1AYzUVgt8 =
217217github.com/raf555/salome v0.0.0-20260217024826-a3f86dff4827 /go.mod h1:1gLJUtlTPmadZFDnTp4LYJibpvUAjULSS5kTWOJ7ANA =
218+ github.com/remychantenay/slog-otel v1.3.4 h1:xoM41ayLff2U8zlK5PH31XwD7Lk3W9wKfl4+RcmKom4 =
219+ github.com/remychantenay/slog-otel v1.3.4 /go.mod h1:ZkazuFMICKGDrO0r1njxKRdjTt/YcXKn6v2+0q/b0+U =
218220github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ =
219221github.com/rogpeppe/go-internal v1.14.1 /go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc =
220222github.com/rs/xid v1.3.0 /go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg =
Original file line number Diff line number Diff line change @@ -18,7 +18,4 @@ var Provider = fx.Module(
1818 return logger .WithContext (ctx , log )
1919 }
2020 }),
21- fx .Invoke (func (l * slog.Logger ) {
22- slog .SetDefault (l )
23- }),
2421)
Original file line number Diff line number Diff line change @@ -4,16 +4,18 @@ import (
44 "log/slog"
55 "os"
66
7+ "github.com/raf555/salome/melt/log"
78 slogformatter "github.com/samber/slog-formatter"
89)
910
1011func New () * slog.Logger {
11- timeDurationFormatter := slogformatter .FormatByKind (slog .KindDuration , func (v slog.Value ) slog.Value {
12+ var handler slog.Handler
13+
14+ handler = slog .NewJSONHandler (os .Stdout , nil )
15+ handler = log .WithOtelHandler (handler )
16+ handler = log .WithFormatter (handler , slogformatter .FormatByKind (slog .KindDuration , func (v slog.Value ) slog.Value {
1217 return slog .StringValue (v .Duration ().String ())
13- })
14- return slog .New (
15- slogformatter .NewFormatterHandler (timeDurationFormatter )(
16- slog .NewJSONHandler (os .Stdout , nil ),
17- ),
18- )
18+ }))
19+
20+ return log .New (handler )
1921}
You can’t perform that action at this time.
0 commit comments