File tree Expand file tree Collapse file tree 2 files changed +6
-16
lines changed Expand file tree Collapse file tree 2 files changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ func NewWorker(opts ...Option) *Worker {
4444 panic (err )
4545 }
4646
47- w .p .SetLoggerLevel (nsq . LogLevel ( w .opts .logLvl ) )
47+ w .p .SetLoggerLevel (w .opts .logLevel )
4848
4949 return w
5050}
@@ -64,8 +64,7 @@ func (w *Worker) startConsumer() (err error) {
6464 return
6565 }
6666
67- w .q .SetLoggerLevel (nsq .LogLevel (w .opts .logLvl ))
68-
67+ w .q .SetLoggerLevel (w .opts .logLevel )
6968 w .q .AddHandler (nsq .HandlerFunc (func (msg * nsq.Message ) error {
7069 if len (msg .Body ) == 0 {
7170 // Returning nil will automatically send a FIN command to NSQ to mark the message as processed.
Original file line number Diff line number Diff line change @@ -9,15 +9,6 @@ import (
99 nsq "github.com/nsqio/go-nsq"
1010)
1111
12- // Log levels (same as [nsq.LogLevel])
13- const (
14- LogLevelDebug nsq.LogLevel = iota
15- LogLevelInfo
16- LogLevelWarning
17- LogLevelError
18- LogLevelMax = iota - 1 // convenience - match highest log level
19- )
20-
2112// An Option configures a mutex.
2213type Option interface {
2314 Apply (* Options )
@@ -38,7 +29,7 @@ type Options struct {
3829 channel string
3930 runFunc func (context.Context , core.QueuedMessage ) error
4031 logger queue.Logger
41- logLvl nsq.LogLevel
32+ logLevel nsq.LogLevel
4233}
4334
4435// WithAddr setup the addr of NSQ
@@ -86,7 +77,7 @@ func WithLogger(l queue.Logger) Option {
8677// WithLogLevel set custom [nsq] log level
8778func WithLogLevel (lvl nsq.LogLevel ) Option {
8879 return OptionFunc (func (o * Options ) {
89- o .logLvl = lvl
80+ o .logLevel = lvl
9081 })
9182}
9283
@@ -97,8 +88,8 @@ func newOptions(opts ...Option) Options {
9788 channel : "ch" ,
9889 maxInFlight : 1 ,
9990
100- logger : queue .NewLogger (),
101- logLvl : LogLevelInfo ,
91+ logger : queue .NewLogger (),
92+ logLevel : nsq . LogLevelInfo ,
10293 runFunc : func (context.Context , core.QueuedMessage ) error {
10394 return nil
10495 },
You can’t perform that action at this time.
0 commit comments