Skip to content

Commit

Permalink
fix readme example
Browse files Browse the repository at this point in the history
  • Loading branch information
nasdf committed Feb 16, 2024
1 parent b2f0951 commit 863c7fd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ Logging library used across Source Network projects.
package main

import (
"log/slog"

"github.com/sourcenetwork/corelog"
)

var log = corelog.NewLogger("main")

func main() {
log.Debug("doing stuff", "key", "val", ...)
log.Debug("doing stuff", "key", "val")

child = log.WithAttrs(slog.Any("key", "val"), ...)
child.Info("doing stuff with attrs", ...)
attrs := log.WithAttrs(slog.Any("key", "val"))
attrs.Info("doing stuff with attrs")

group = log.WithGroup("group")
group.Info("doing stuff with group", "key", "val", ...)
group := log.WithGroup("group")
group.Info("doing stuff with group", "key", "val")
}
```

Expand Down

0 comments on commit 863c7fd

Please sign in to comment.