-
Notifications
You must be signed in to change notification settings - Fork 0
/
logging.go
32 lines (25 loc) · 1006 Bytes
/
logging.go
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
27
28
29
30
31
32
package logging
import (
"github.com/graphmetrics/graphmetrics-go/internal/conversion"
"github.com/graphmetrics/logger-go"
"github.com/graphmetrics/logger-go/options"
"github.com/hashicorp/go-retryablehttp"
)
type retryableLogger struct {
parent logger.Logger
}
func NewRetryableLogger(parent logger.Logger) retryablehttp.LeveledLogger {
return &retryableLogger{parent.WithOptions(options.CallerSkipOffset{Offset: 1})}
}
func (r retryableLogger) Debug(msg string, keysAndValues ...interface{}) {
r.parent.Debug(msg, conversion.KeysAndValuesToMap(keysAndValues))
}
func (r retryableLogger) Info(msg string, keysAndValues ...interface{}) {
r.parent.Info(msg, conversion.KeysAndValuesToMap(keysAndValues))
}
func (r retryableLogger) Warn(msg string, keysAndValues ...interface{}) {
r.parent.Warn(msg, conversion.KeysAndValuesToMap(keysAndValues))
}
func (r retryableLogger) Error(msg string, keysAndValues ...interface{}) {
r.parent.Error(msg, conversion.KeysAndValuesToMap(keysAndValues))
}