blob: 490445e17316815cccffcdd7e76f4df633f9c85b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package logging
import (
"go.uber.org/zap"
"time"
)
// Logger wraps zap.SugaredLogger and
// allows to get the interval for periodic logging.
type Logger struct {
*zap.SugaredLogger
interval time.Duration
}
// NewLogger returns a new Logger.
func NewLogger(base *zap.SugaredLogger, interval time.Duration) *Logger {
return &Logger{
SugaredLogger: base,
interval: interval,
}
}
// Interval returns the interval for periodic logging.
func (l *Logger) Interval() time.Duration {
return l.interval
}
|