Skip to content

Commit

Permalink
bump v1
Browse files Browse the repository at this point in the history
  • Loading branch information
samber committed Aug 9, 2023
1 parent a188d7d commit 55f25b8
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.20.3
go-version: 1.21
stable: false
- uses: actions/checkout@v2
- name: golangci-lint
Expand Down Expand Up @@ -41,4 +41,4 @@ jobs:
# skip-build-cache: true

# optionally use a specific version of Go rather than the latest one
go_version: '1.20.3'
go_version: '1.21'
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.20.3
go-version: 1.21
stable: false

- name: Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.20.3
go-version: 1.21
stable: false

- name: Build
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Slog sampling policy

[![tag](https://img.shields.io/github/tag/samber/slog-sampling.svg)](https://github.com/samber/slog-sampling/releases)
![Go Version](https://img.shields.io/badge/Go-%3E%3D%201.20.3-%23007d9c)
![Go Version](https://img.shields.io/badge/Go-%3E%3D%201.21-%23007d9c)
[![GoDoc](https://godoc.org/github.com/samber/slog-sampling?status.svg)](https://pkg.go.dev/github.com/samber/slog-sampling)
![Build Status](https://github.com/samber/slog-sampling/actions/workflows/test.yml/badge.svg)
[![Go report](https://goreportcard.com/badge/github.com/samber/slog-sampling)](https://goreportcard.com/report/github.com/samber/slog-sampling)
Expand Down Expand Up @@ -43,11 +43,9 @@ Sampling fixes throughput by dropping repetitive log entries.
go get github.com/samber/slog-sampling
```

**Compatibility**: go >= 1.20.3
**Compatibility**: go >= 1.21

This library is v0 and follows SemVer strictly. On `slog` final release (go 1.21), this library will go v1.

No breaking changes will be made to exported APIs before v1.0.0.
No breaking changes will be made to exported APIs before v2.0.0.

## 💡 Usage

Expand Down Expand Up @@ -82,7 +80,7 @@ Using `slog-multi`:
import (
slogmulti "github.com/samber/slog-multi"
slogsampling "github.com/samber/slog-sampling"
"golang.org/x/exp/slog"
"log/slog"
)

// Will print 30% of entries.
Expand Down Expand Up @@ -129,7 +127,7 @@ Using `slog-multi`:
import (
slogmulti "github.com/samber/slog-multi"
slogsampling "github.com/samber/slog-sampling"
"golang.org/x/exp/slog"
"log/slog"
)

// Will print the first 10 entries having the same level+message, then every 10th messages until next interval.
Expand Down Expand Up @@ -172,7 +170,7 @@ Using `slog-multi`:
import (
slogmulti "github.com/samber/slog-multi"
slogsampling "github.com/samber/slog-sampling"
"golang.org/x/exp/slog"
"log/slog"
)

// Will print 100% of log entries during the night, or 50% of errors, 20% of warnings and 1% of lower levels.
Expand Down
2 changes: 1 addition & 1 deletion counters.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"sync/atomic"
"time"

"golang.org/x/exp/slog"
"log/slog"
)

const countersPerLevel = 4096
Expand Down
3 changes: 2 additions & 1 deletion example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
"sync/atomic"
"time"

"log/slog"

slogmulti "github.com/samber/slog-multi"
slogsampling "github.com/samber/slog-sampling"
"golang.org/x/exp/slog"
)

func main() {
Expand Down
10 changes: 6 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
module github.com/samber/slog-sampling

go 1.20
go 1.21

require (
github.com/samber/slog-multi v0.6.0
github.com/samber/slog-multi v1.0.0
go.uber.org/goleak v1.2.1
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
)

require github.com/samber/lo v1.38.1 // indirect
require (
github.com/samber/lo v1.38.1 // indirect
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
)
8 changes: 6 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM=
github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
github.com/samber/slog-multi v0.6.0 h1:PlkNfE+4HlDz32PdZvVfofEwndsf6Hkjo+SiHdnVZf8=
github.com/samber/slog-multi v0.6.0/go.mod h1:tframyieOY2ATooyXYheljn9FzBCAz+gGxpwWWvtVfg=
github.com/samber/slog-multi v1.0.0 h1:snvP/P5GLQ8TQh5WSqdRaxDANW8AAA3egwEoytLsqvc=
github.com/samber/slog-multi v1.0.0/go.mod h1:uLAvHpGqbYgX4FSL0p1ZwoLuveIAJvBECtE07XmYvFo=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package slogsampling
import (
"context"

"golang.org/x/exp/slog"
"log/slog"
)

func hook(hook func(context.Context, slog.Record), ctx context.Context, record slog.Record) {
Expand Down
3 changes: 2 additions & 1 deletion middleware_custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"math/rand"
"time"

"log/slog"

slogmulti "github.com/samber/slog-multi"
"golang.org/x/exp/slog"
)

type CustomSamplingOption struct {
Expand Down
3 changes: 2 additions & 1 deletion middleware_threshold.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"math/rand"
"time"

"log/slog"

slogmulti "github.com/samber/slog-multi"
"golang.org/x/exp/slog"
)

type ThresholdSamplingOption struct {
Expand Down
3 changes: 2 additions & 1 deletion middleware_uniform.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"math/rand"
"time"

"log/slog"

slogmulti "github.com/samber/slog-multi"
"golang.org/x/exp/slog"
)

type UniformSamplingOption struct {
Expand Down

0 comments on commit 55f25b8

Please sign in to comment.