Skip to content

Commit

Permalink
Merge pull request #1 from mark-rushakoff/update-slog
Browse files Browse the repository at this point in the history
Update to latest version of slog
  • Loading branch information
neilotoole committed May 31, 2023
2 parents e7ca612 + b747081 commit 3224960
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/neilotoole/slogt

go 1.20

require golang.org/x/exp v0.0.0-20230321023759-10a507213a29
require golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU=
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
4 changes: 2 additions & 2 deletions slogt.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func Text() Option {
Level: slog.LevelDebug,
}
// The opts may have already set the handler.
b.Handler = hOpts.NewTextHandler(b.buf)
b.Handler = slog.NewTextHandler(b.buf, &hOpts)
}
}

Expand All @@ -46,7 +46,7 @@ func JSON() Option {
Level: slog.LevelDebug,
}
// The opts may have already set the handler.
b.Handler = hOpts.NewJSONHandler(b.buf)
b.Handler = slog.NewJSONHandler(b.buf, &hOpts)
}
}

Expand Down
12 changes: 6 additions & 6 deletions slogt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (
)

func TestSlog_Ugly(t *testing.T) {
log := slog.New(slog.NewTextHandler(os.Stdout))
log := slog.New(slog.NewTextHandler(os.Stdout, nil))
t.Log("I am indented correctly")
log.Info("But I am not")
}
Expand All @@ -37,7 +37,7 @@ func TestSlog_Ugly_Parallel(t *testing.T) {
t.Run(strconv.Itoa(i), func(t *testing.T) {
t.Parallel()

handler := slog.NewTextHandler(os.Stdout)
handler := slog.NewTextHandler(os.Stdout, nil)
log := slog.New(handler)

for j := 0; j < iter; j++ {
Expand Down Expand Up @@ -95,9 +95,9 @@ func TestJSON(t *testing.T) {
func TestFactory(t *testing.T) {
// This factory returns a slog.Handler using slog.LevelError.
f := slogt.Factory(func(w io.Writer) slog.Handler {
return slog.HandlerOptions{
return slog.NewTextHandler(w, &slog.HandlerOptions{
Level: slog.LevelError,
}.NewTextHandler(w)
})
})

log := slogt.New(t, f)
Expand All @@ -107,9 +107,9 @@ func TestFactory(t *testing.T) {

func TestCaller(t *testing.T) {
f := slogt.Factory(func(w io.Writer) slog.Handler {
return slog.HandlerOptions{
return slog.NewTextHandler(w, &slog.HandlerOptions{
AddSource: true,
}.NewTextHandler(w)
})
})

log := slogt.New(t, f)
Expand Down

0 comments on commit 3224960

Please sign in to comment.