diff --git a/backends/memory/memory_backend.go b/backends/memory/memory_backend.go index c337860..e5b70cc 100644 --- a/backends/memory/memory_backend.go +++ b/backends/memory/memory_backend.go @@ -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 diff --git a/backends/postgres/postgres_backend.go b/backends/postgres/postgres_backend.go index 290025e..9a43b73 100644 --- a/backends/postgres/postgres_backend.go +++ b/backends/postgres/postgres_backend.go @@ -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) diff --git a/backends/postgres/postgres_backend_test.go b/backends/postgres/postgres_backend_test.go index 15bce61..be297b7 100644 --- a/backends/postgres/postgres_backend_test.go +++ b/backends/postgres/postgres_backend_test.go @@ -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() }) diff --git a/backends/redis/redis_backend.go b/backends/redis/redis_backend.go index ed42f79..e20c95b 100644 --- a/backends/redis/redis_backend.go +++ b/backends/redis/redis_backend.go @@ -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 diff --git a/env.sample b/env.sample index 4484946..0954d28 100644 --- a/env.sample +++ b/env.sample @@ -1,4 +1,3 @@ TEST_DATABASE_URL= TEST_REDIS_URL= REDIS_PASSWORD= - diff --git a/go.mod b/go.mod index 171dd9a..a57f222 100644 --- a/go.mod +++ b/go.mod @@ -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 ( diff --git a/go.sum b/go.sum index 0b87dea..fd61bd0 100644 --- a/go.sum +++ b/go.sum @@ -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=