# Packages
No description provided by the author
# README
slog-utils: utilities to work with slog
Utilities for slog for
calldepth
, add caller skip for helper functions e.g. in 3rd party libraries e.g. temporal et el.
calldepth: add caller skip, similar to that provided by
- zap provides
AddCallerSkip
—this plusWithOptions
allows for a simple adjustment in helpers as shown here - zerolog provides
Caller
andCallerSkipFrame
- go-kit/log provides
Caller
(and there's some discussion of makingCaller
even more helpful to users) - glog provides several
X-Depth
functions that allow the user to adjust the depth - the stdlib log provides
Output
code taken from https://github.com/golang/go/issues/59145#issuecomment-1481920720
🚀 Install
go get go.breu.io/slog-utils
Compatibility: go >= 1.21
- ⚠️ Work in Progress
- ⚠️ Use this library carefully, log processing can be very costly (!)
💡 Usage
package main
import (
"log/slog"
"go.temporal.io/sdk/client"
"go.breu.io/slog-utils/calldepth"
)
func main() {
adapter := calldepth.NewAdapter(
calldepth.NewLogger(slog.NewStdLogger()),
calldepth.WithCallDepth(5), // 5 for activities, 6 for workflows.
)
opts := client.Options{
HostPort: "localhost:7233",
Logger: adapter.WithGroup("temporal"),
}
tclient, err := client.Dial(opts)
}
👤 Contributors
📝 License
Copyright © 2023 Breu Inc.
This project is MIT licensed.