forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.go
31 lines (24 loc) · 881 Bytes
/
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
package logp
import "fmt"
// Logger provides a logging type using the global logp functionality.
// The Logger should be used to use with libraries havng a configurable logging
// functionality.
type Logger struct {
selector string
}
// NewLogger creates a new Logger instance with custom debug selector.
func NewLogger(selector string) *Logger {
return &Logger{selector: selector}
}
func (l *Logger) Debug(vs ...interface{}) {
Debug(l.selector, "%v", fmt.Sprint(vs...))
}
func (*Logger) Info(vs ...interface{}) {
Info("%v", fmt.Sprint(vs...))
}
func (*Logger) Err(vs ...interface{}) {
Err("%v", fmt.Sprint(vs...))
}
func (l *Logger) Debugf(format string, v ...interface{}) { Debug(l.selector, format, v...) }
func (*Logger) Infof(format string, v ...interface{}) { Info(format, v...) }
func (*Logger) Errf(format string, v ...interface{}) { Err(format, v...) }