Skip to content

Commit 950fad3

Browse files
committed
Upgrade slog package to release version
1 parent e2bb1b4 commit 950fad3

17 files changed

+23
-30
lines changed

binary/binary.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ import (
77
"errors"
88
"fmt"
99
"io"
10+
"log/slog"
1011
"math"
1112
"sync"
1213
"time"
13-
14-
"golang.org/x/exp/slog"
1514
)
1615

1716
type Encoder struct {

go.mod

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
module github.com/jba/slog
22

3-
go 1.19
3+
go 1.21
44

55
require (
66
github.com/go-kit/log v0.2.1
77
github.com/google/go-cmp v0.5.9
88
go.opentelemetry.io/otel/trace v1.11.2
9-
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb
109
)
1110

1211
require (

go.sum

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
23
github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
34
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
45
github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
56
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
67
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
78
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
89
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
10+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
911
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
12+
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
1013
go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0=
1114
go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI=
1215
go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0=
1316
go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA=
14-
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb h1:mIKbk8weKhSeLH2GmUTrvx8CjkyJmnU1wFmg59CUjFA=
15-
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
1617
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
18+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

gokit/gokit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ package gokit
66
import (
77
"context"
88
"fmt"
9+
"log/slog"
910
"time"
1011

1112
gklog "github.com/go-kit/log"
1213
gklevel "github.com/go-kit/log/level"
13-
"golang.org/x/exp/slog"
1414
)
1515

1616
// New returns go-kit logger that calls h.Handle.

gokit/gokit_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ package gokit
22

33
import (
44
"bytes"
5+
"log/slog"
56
"strings"
67
"testing"
78

89
gklevel "github.com/go-kit/log/level"
9-
"golang.org/x/exp/slog"
1010
)
1111

1212
func Test(t *testing.T) {

handlers/binary.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ package handlers
22

33
import (
44
"io"
5-
6-
"golang.org/x/exp/slog"
5+
"log/slog"
76
)
87

98
// BinaryHandler uses the format in github.com/jba/slog/binary

handlers/general/general_handler.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ import (
66
"encoding/json"
77
"fmt"
88
"io"
9+
"log/slog"
910
"reflect"
11+
"slices"
1012
"strconv"
1113
"strings"
1214
"sync"
1315
"time"
1416
"unicode"
1517
"unicode/utf8"
16-
17-
"golang.org/x/exp/slices"
18-
"golang.org/x/exp/slog"
1918
)
2019

2120
// Handler implements a [slog.Handler] that can produce a variety of output

handlers/general/general_handler_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import (
44
"bytes"
55
"context"
66
"encoding/json"
7+
"log/slog"
78
"strings"
89
"testing"
910
"time"
10-
11-
"golang.org/x/exp/slog"
1211
)
1312

1413
type Attr = slog.Attr
@@ -111,7 +110,7 @@ func TestHandler(t *testing.T) {
111110
replace: removeKeys(slog.TimeKey, slog.LevelKey),
112111
attrs: []Attr{slog.Group("g"), slog.Group("h", slog.Int("a", 1))},
113112
wantText: "msg=message h.a=1",
114-
wantJSON: `{"msg":"message","g":{},"h":{"a":1}}`,
113+
wantJSON: `{"msg":"message","h":{"a":1}}`,
115114
},
116115
{
117116
name: "inline group",

handlers/loghandler/log_handler.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ import (
55
"context"
66
"fmt"
77
"io"
8+
"log/slog"
89
"runtime"
910
"strconv"
1011
"sync"
1112
"time"
12-
13-
"golang.org/x/exp/slog"
1413
)
1514

1615
type Handler struct {

handlers/loghandler/log_handler_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ import (
44
"bytes"
55
"context"
66
"io"
7+
"log/slog"
78
"testing"
89
"time"
9-
10-
"golang.org/x/exp/slog"
1110
)
1211

1312
var testTime = time.Date(2023, time.April, 3, 1, 2, 3, 0, time.UTC)

handlers/simple/simple_handler.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ package simple
22

33
import (
44
"context"
5+
"log/slog"
6+
"slices"
57

68
"github.com/jba/slog/withsupport"
7-
"golang.org/x/exp/slices"
8-
"golang.org/x/exp/slog"
99
)
1010

1111
func Handler(handle func(slog.Record) error, opts slog.HandlerOptions) slog.Handler {

handlers/simple/simple_handler_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import (
44
"bytes"
55
"fmt"
66
"io"
7+
"log/slog"
78
"testing"
8-
9-
"golang.org/x/exp/slog"
109
)
1110

1211
func newHandle(w io.Writer) func(slog.Record) error {

trace/trace_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ package trace
22

33
import (
44
"context"
5+
"log/slog"
56
"testing"
6-
7-
"golang.org/x/exp/slog"
87
)
98

109
func Test(t *testing.T) {

verbosity/verbosity.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Level = INFO - verbosity
77
package verbosity
88

9-
import "golang.org/x/exp/slog"
9+
import "log/slog"
1010

1111
// ToLevel converts a verbosity to a Level.
1212
func ToLevel(verbosity int) slog.Level {

verbosity/verbosity_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package verbosity
33
import (
44
"testing"
55

6-
"golang.org/x/exp/slog"
6+
"log/slog"
77
)
88

99
func TestToLevel(t *testing.T) {

withsupport/withsupport.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Handler.WithGroup.
33
package withsupport
44

5-
import "golang.org/x/exp/slog"
5+
import "log/slog"
66

77
// GroupOrAttrs holds either a group name or a list of slog.Attrs.
88
type GroupOrAttrs struct {

withsupport/withsupport_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import (
55
"context"
66
"fmt"
77
"io"
8+
"log/slog"
89
"strings"
910
"testing"
1011

1112
"github.com/google/go-cmp/cmp"
12-
"golang.org/x/exp/slog"
1313
)
1414

1515
type handler struct {

0 commit comments

Comments
 (0)