summaryrefslogtreecommitdiffstats
path: root/pkg/logging/logger.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkg/logging/logger.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/pkg/logging/logger.go b/pkg/logging/logger.go
new file mode 100644
index 0000000..490445e
--- /dev/null
+++ b/pkg/logging/logger.go
@@ -0,0 +1,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
+}