mirror of
https://github.com/chainguard-dev/clog
synced 2026-07-06 22:12:46 +00:00
Fix handler example to actually use the handler. (#4)
This commit is contained in:
parent
988f6253cd
commit
c071a43a42
1 changed files with 3 additions and 3 deletions
|
|
@ -10,17 +10,17 @@ import (
|
|||
)
|
||||
|
||||
func ExampleHandler() {
|
||||
log := slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
|
||||
log := slog.New(slogctx.NewHandler(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
|
||||
// Remove time for repeatable results
|
||||
ReplaceAttr: slogtest.RemoveTime,
|
||||
}))
|
||||
})))
|
||||
|
||||
ctx := context.Background()
|
||||
ctx = slogctx.WithValues(ctx, "foo", "bar")
|
||||
log.InfoContext(ctx, "hello world", slog.Bool("baz", true))
|
||||
|
||||
// Output:
|
||||
// level=INFO msg="hello world" baz=true
|
||||
// level=INFO msg="hello world" baz=true foo=bar
|
||||
}
|
||||
|
||||
func ExampleLogger() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue