This repository was archived by the owner on Jan 21, 2025. It is now read-only.
generated from logur/integration-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.go
73 lines (56 loc) · 1.75 KB
/
logger.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Package invision provides Logur integration for InVision go-logger interface.
package invision
import (
"fmt"
"strings"
log "github.com/InVisionApp/go-logger"
"logur.dev/logur"
)
// Logger is a github.com/InVisionApp/go-logger.Logger logger.
type Logger struct {
logger logur.Logger
}
// New returns a new github.com/InVisionApp/go-logger.Logger logger.
func New(logger logur.Logger) *Logger {
return &Logger{logger: logger}
}
func (l *Logger) Debug(msg ...interface{}) {
l.logger.Debug(fmt.Sprint(msg...))
}
func (l *Logger) Info(msg ...interface{}) {
l.logger.Info(fmt.Sprint(msg...))
}
func (l *Logger) Warn(msg ...interface{}) {
l.logger.Warn(fmt.Sprint(msg...))
}
func (l *Logger) Error(msg ...interface{}) {
l.logger.Error(fmt.Sprint(msg...))
}
func (l *Logger) Debugln(msg ...interface{}) {
l.Debug(strings.TrimSuffix(fmt.Sprintln(msg...), "\n"))
}
func (l *Logger) Infoln(msg ...interface{}) {
l.Info(strings.TrimSuffix(fmt.Sprintln(msg...), "\n"))
}
func (l *Logger) Warnln(msg ...interface{}) {
l.Warn(strings.TrimSuffix(fmt.Sprintln(msg...), "\n"))
}
func (l *Logger) Errorln(msg ...interface{}) {
l.Error(strings.TrimSuffix(fmt.Sprintln(msg...), "\n"))
}
func (l *Logger) Debugf(format string, args ...interface{}) {
l.Debug(fmt.Sprintf(format, args...))
}
func (l *Logger) Infof(format string, args ...interface{}) {
l.Info(fmt.Sprintf(format, args...))
}
func (l *Logger) Warnf(format string, args ...interface{}) {
l.Warn(fmt.Sprintf(format, args...))
}
func (l *Logger) Errorf(format string, args ...interface{}) {
l.Error(fmt.Sprintf(format, args...))
}
// WithFields returns a new logger with the additional supplied fields.
func (l *Logger) WithFields(fields log.Fields) log.Logger {
return &Logger{logur.WithFields(l.logger, fields)}
}