-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebuglogger.go
54 lines (44 loc) · 1.28 KB
/
debuglogger.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package yalp
import "go.uber.org/zap"
// DebugLogger is the default logger used for the Quirk client.
// This logger will not print anything out.
type DebugLogger struct {
logger *zap.Logger
}
var _ Logger = &DebugLogger{}
// NewDebugLogger returns a nil logging
// object for the Quirk client to use.
func NewDebugLogger() *DebugLogger {
l, _ := zap.NewDevelopment()
return &DebugLogger{
logger: l,
}
}
// Info does nothing.
func (l *DebugLogger) Info(msg string, iFields ...interface{}) {
fields := interfaceToZapField(iFields...)
l.logger.Info(msg, fields...)
}
// Debug logs nothing.
func (l *DebugLogger) Debug(msg string, iFields ...interface{}) {
fields := interfaceToZapField(iFields...)
l.logger.Debug(msg, fields...)
}
// Error logs nothing.
func (l *DebugLogger) Error(msg string, iFields ...interface{}) {
fields := interfaceToZapField(iFields...)
l.logger.Error(msg, fields...)
}
// Warn does nothing.
func (l *DebugLogger) Warn(msg string, iFields ...interface{}) {
fields := interfaceToZapField(iFields...)
l.logger.Warn(msg, fields...)
}
// Fatal logs nothing.
func (l *DebugLogger) Fatal(msg string, iFields ...interface{}) {
fields := interfaceToZapField(iFields...)
l.logger.Fatal(msg, fields...)
}
func (l *DebugLogger) Sync() error {
return l.logger.Sync()
}