mirror of
https://github.com/acaloiaro/neoq
synced 2026-07-21 18:29:08 +00:00
Add log level to redis and memory backends (#50)
This commit is contained in:
parent
43a0a133f2
commit
d68db7b442
2 changed files with 4 additions and 2 deletions
|
|
@ -51,7 +51,6 @@ func Backend(ctx context.Context, opts ...config.Option) (backend types.Backend,
|
|||
handlers: &sync.Map{},
|
||||
futureJobs: &sync.Map{},
|
||||
fingerprints: &sync.Map{},
|
||||
logger: slog.New(slog.NewTextHandler(os.Stdout)),
|
||||
jobCount: 0,
|
||||
cancelFuncs: []context.CancelFunc{},
|
||||
}
|
||||
|
|
@ -61,6 +60,8 @@ 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))
|
||||
|
||||
backend = mb
|
||||
|
||||
return
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ func Backend(ctx context.Context, opts ...config.Option) (backend types.Backend,
|
|||
b := &redisBackend{
|
||||
config: config.New(),
|
||||
mu: &sync.Mutex{},
|
||||
logger: slog.New(slog.NewTextHandler(os.Stdout)),
|
||||
taskProvider: NewMemoryTaskConfigProvider(),
|
||||
}
|
||||
|
||||
|
|
@ -84,6 +83,8 @@ 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))
|
||||
|
||||
if b.config.ConnectionString == "" {
|
||||
err = ErrInvalidAddr
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in a new issue