diff options
| author | mo khan <mo@mokhan.ca> | 2025-03-27 11:47:58 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-03-27 11:47:58 -0600 |
| commit | 3faa19c3aeae15070f2e143b031daaddfe296735 (patch) | |
| tree | dc86e49908920c10479b9e9905c58c0c44e2cee6 /pkg/cfg | |
| parent | b08580ff78708519f0594a62531cf6ce45559265 (diff) | |
feat: start to add structured logging
Diffstat (limited to 'pkg/cfg')
| -rw-r--r-- | pkg/cfg/mux.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pkg/cfg/mux.go b/pkg/cfg/mux.go index 694ee9e..a55b443 100644 --- a/pkg/cfg/mux.go +++ b/pkg/cfg/mux.go @@ -1,9 +1,17 @@ package cfg -import "net/http" +import ( + "net/http" + + sloghttp "github.com/samber/slog-http" + xlog "gitlab.com/mokhax/spike/pkg/log" +) func WithMux(mux http.Handler) Option { return func(config *Config) { - config.Mux = mux + config.Mux = sloghttp.NewWithConfig(xlog.Logger, sloghttp.Config{ + WithSpanID: true, + WithTraceID: true, + })(sloghttp.Recovery(mux)) } } |
