mirror of
https://github.com/HDT3213/delayqueue.git
synced 2025-10-05 15:16:57 +08:00
This commit is contained in:
@@ -27,7 +27,7 @@ type DelayQueue struct {
|
||||
garbageKey string // set: message id
|
||||
useHashTag bool
|
||||
ticker *time.Ticker
|
||||
logger *log.Logger
|
||||
logger Logger
|
||||
close chan struct{}
|
||||
running int32
|
||||
maxConsumeDuration time.Duration // default 5 seconds
|
||||
@@ -82,6 +82,11 @@ type RedisCli interface {
|
||||
EvalSha(sha1 string, keys []string, args []interface{}) (interface{}, error)
|
||||
}
|
||||
|
||||
// Logger is an abstraction of logging system
|
||||
type Logger interface {
|
||||
Printf(format string, v ...interface{})
|
||||
}
|
||||
|
||||
type hashTagKeyOpt int
|
||||
|
||||
// CallbackFunc receives and consumes messages
|
||||
@@ -153,7 +158,7 @@ func (q *DelayQueue) WithCallback(callback CallbackFunc) *DelayQueue {
|
||||
}
|
||||
|
||||
// WithLogger customizes logger for queue
|
||||
func (q *DelayQueue) WithLogger(logger *log.Logger) *DelayQueue {
|
||||
func (q *DelayQueue) WithLogger(logger Logger) *DelayQueue {
|
||||
q.logger = logger
|
||||
return q
|
||||
}
|
||||
|
Reference in New Issue
Block a user