-
Notifications
You must be signed in to change notification settings - Fork 1
/
log.go
58 lines (46 loc) · 1.24 KB
/
log.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
package log
import "github.com/sirupsen/logrus"
// init sets the global logrus settings
func init() {
logrus.SetLevel(logrus.DebugLevel)
}
//Debug Debug wrapper method
func Debug(args ...interface{}) {
logrus.Debug(args...)
}
//Debugf Debugf wrapper method
func Debugf(format string, args ...interface{}) {
logrus.Debugf(format, args)
}
//Fatal wrapper method
func Fatal(args ...interface{}) {
logrus.Fatal(args...)
}
//Error wrapper method
func Error(args ...interface{}) {
logrus.Error(args...)
}
//Errorf wrapper method
func Errorf(format string, args ...interface{}) {
logrus.Errorf(format, args)
}
//WithField wrapper method
func WithField(key string, arg interface{}) *logrus.Entry {
return logrus.WithField(key, arg)
}
//WithFields wrapper method
func WithFields(fields logrus.Fields) *logrus.Entry {
return logrus.WithFields(fields)
}
//WithError wrapper method
func WithError(err error) *logrus.Entry {
return logrus.WithError(err)
}
// Method allows one to quickly log the method field
func Method(method interface{}) *logrus.Entry {
return logrus.WithField("method", method)
}
// Function allows one to quickly log the method field
func Function(function interface{}) *logrus.Entry {
return logrus.WithField("function", function)
}