-
Notifications
You must be signed in to change notification settings - Fork 33
/
log.go
64 lines (52 loc) · 1.78 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
59
60
61
62
63
64
package log
import "github.com/op/go-logging"
// Logger is the logger interface
type Logger interface {
Debug(args ...interface{})
Debugf(format string, args ...interface{})
Info(args ...interface{})
Infof(format string, args ...interface{})
Warning(args ...interface{})
Warningf(format string, args ...interface{})
Error(args ...interface{})
Errorf(format string, args ...interface{})
}
// The global logger object
var logger Logger = logging.MustGetLogger("nnet")
// SetLogger sets the global logger object
func SetLogger(l Logger) error {
logger = l
return nil
}
// Debug logs to the DEBUG log. Arguments are handled in the manner of fmt.Print.
func Debug(args ...interface{}) {
logger.Debug(args...)
}
// Debugf logs to the DEBUG log. Arguments are handled in the manner of fmt.Printf.
func Debugf(format string, args ...interface{}) {
logger.Debugf(format, args...)
}
// Info logs to the INFO log. Arguments are handled in the manner of fmt.Print.
func Info(args ...interface{}) {
logger.Info(args...)
}
// Infof logs to the INFO log. Arguments are handled in the manner of fmt.Printf.
func Infof(format string, args ...interface{}) {
logger.Infof(format, args...)
}
// Warning logs to the WARN log. Arguments are handled in the manner of fmt.Print.
func Warning(args ...interface{}) {
logger.Warning(args...)
}
// Warningf logs to the WARN log. Arguments are handled in the manner of fmt.Printf.
func Warningf(format string, args ...interface{}) {
logger.Warningf(format, args...)
}
// Error logs to the ERROR log. Arguments are handled in the manner of fmt.Print.
func Error(args ...interface{}) {
logger.Error(args...)
}
// Errorf logs to the ERROR log. Arguments are handled in the manner of fmt.Printf.
func Errorf(format string, args ...interface{}) {
logger.Errorf(format, args...)
}