-
Notifications
You must be signed in to change notification settings - Fork 2
/
logger.go
58 lines (41 loc) · 1.83 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
package config
import "github.com/betorvs/sonarqube-to-gitlab-webhook/appcontext"
// Logger interface defining expected methods for logging
type Logger interface {
// Debug uses fmt.Sprint to construct and log a message.
Debug(args ...interface{})
// Info uses fmt.Sprint to construct and log a message.
Info(args ...interface{})
// Warn uses fmt.Sprint to construct and log a message.
Warn(args ...interface{})
// Error uses fmt.Sprint to construct and log a message.
Error(args ...interface{})
// DPanic uses fmt.Sprint to construct and log a message. In development, the
// logger then panics. (See DPanicLevel for details.)
DPanic(args ...interface{})
// Panic uses fmt.Sprint to construct and log a message, then panics.
Panic(args ...interface{})
// Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
Fatal(args ...interface{})
// Debugf uses fmt.Sprintf to log a templated message.
Debugf(template string, args ...interface{})
// Infof uses fmt.Sprintf to log a templated message.
Infof(template string, args ...interface{})
// Warnf uses fmt.Sprintf to log a templated message.
Warnf(template string, args ...interface{})
// Errorf uses fmt.Sprintf to log a templated message.
Errorf(template string, args ...interface{})
// DPanicf uses fmt.Sprintf to log a templated message. In development, the
// logger then panics. (See DPanicLevel for details.)
DPanicf(template string, args ...interface{})
// Panicf uses fmt.Sprintf to log a templated message, then panics.
Panicf(template string, args ...interface{})
// Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.
Fatalf(template string, args ...interface{})
//Sync flushes the log if needed
Sync()
}
//GetLogger s Current implementation
func GetLogger() Logger {
return appcontext.Current.Get(appcontext.Logger).(Logger)
}