Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix slog API change issue #54

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions backends/memory/memory_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ func Backend(ctx context.Context, opts ...config.Option) (backend types.Backend,
opt(mb.config)
}

mb.logger = slog.New(slog.HandlerOptions{Level: mb.config.LogLevel}.NewTextHandler(os.Stdout))

mb.logger = slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{Level: mb.config.LogLevel}))
backend = mb

return
Expand Down
2 changes: 1 addition & 1 deletion backends/postgres/postgres_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func Backend(ctx context.Context, opts ...config.Option) (pb types.Backend, err
opt(p.config)
}

p.logger = slog.New(slog.HandlerOptions{Level: p.config.LogLevel}.NewTextHandler(os.Stdout))
p.logger = slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{Level: p.config.LogLevel}))
ctx, cancel := context.WithCancel(ctx)
p.mu.Lock()
p.cancelFuncs = append(p.cancelFuncs, cancel)
Expand Down
2 changes: 1 addition & 1 deletion backends/postgres/postgres_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func TestBasicJobProcessingWithErrors(t *testing.T) {
t.Error(err)
}

nq.SetLogger(slog.New(slog.HandlerOptions{Level: slog.LevelDebug}.NewTextHandler(os.Stdout)))
nq.SetLogger(slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{Level: logging.LogLevelDebug})))
t.Cleanup(func() {
flushDB()
})
Expand Down
3 changes: 1 addition & 2 deletions backends/redis/redis_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ func Backend(ctx context.Context, opts ...config.Option) (backend types.Backend,
opt(b.config)
}

b.logger = slog.New(slog.HandlerOptions{Level: b.config.LogLevel}.NewTextHandler(os.Stdout))

b.logger = slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{Level: b.config.LogLevel}))
if b.config.ConnectionString == "" {
err = ErrInvalidAddr
return
Expand Down
1 change: 0 additions & 1 deletion env.sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
TEST_DATABASE_URL=<TEST_DATABASE_URL>
TEST_REDIS_URL=<TEST_REDIS_URL>
REDIS_PASSWORD=<REDIS_PASSWORD>

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/jsuar/go-cron-descriptor v0.1.0
github.com/pkg/errors v0.8.1
github.com/robfig/cron v1.2.0
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1
)

require (
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o=
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw=
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
Expand Down
Loading