logging options added

This commit is contained in:
nquidox 2026-04-03 11:21:13 +03:00
parent 4810a8666e
commit e58b052251

View file

@ -1,6 +1,11 @@
package rabbit
import "time"
import (
"io"
"log"
"os"
"time"
)
type Option func(*options)
@ -39,3 +44,17 @@ func WithConsumerBurstSize(t int) Option {
op.consumerBurstSize = t
}
}
func WithLogger(l *log.Logger) Option {
return func(op *options) { op.logger = l }
}
func WithLogging(enabled bool) Option {
return func(op *options) {
if enabled {
op.logger = log.New(os.Stdout, "", log.LstdFlags)
} else {
op.logger = log.New(io.Discard, "", 0)
}
}
}