-
Notifications
You must be signed in to change notification settings - Fork 1
/
pkg.go
157 lines (126 loc) · 3.2 KB
/
pkg.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
package log
// Log represents default log
var Log Interface = &Logger{
Handler: HandlerFunc(handleStdLog),
Level: InfoLevel,
}
// SetHandler sets the handler. This is not thread-safe.
// The default handler outputs to the stdlib log.
func SetHandler(h Handler) {
if logger, ok := Log.(*Logger); ok {
logger.Handler = h
}
}
//SetEnvProject sets the env,project and hostname fields into log.
func SetEnvProject(env string, project string) *Entry {
return Log.SetEnvProject(env, project)
}
// SetLevel sets the log level. This is not thread-safe.
func SetLevel(l Level) {
if logger, ok := Log.(*Logger); ok {
logger.Level = l
}
}
// SetLevelFromString sets the log level from a string, panicing when invalid. This is not thread-safe.
func SetLevelFromString(s string) {
if logger, ok := Log.(*Logger); ok {
logger.Level = MustParseLevel(s)
}
}
// WithFields returns a new entry with `fields` set.
func WithFields(fields Fielder) *Entry {
return Log.WithFields(fields)
}
// WithField returns a new entry with the `key` and `value` set.
func WithField(key string, value interface{}) *Entry {
return Log.WithField(key, value)
}
// WithError returns a new entry with the "error" set to `err`.
func WithError(err error) *Entry {
return Log.WithError(err)
}
/********* Pkg wide simple *********/
/* WARNING: This part is autogenerated! Do not change! */
// Debug level message.
func Debug(msg string) {
Log.Debug(msg)
}
// Info level message.
func Info(msg string) {
Log.Info(msg)
}
// Notice level message.
func Notice(msg string) {
Log.Notice(msg)
}
// Warn level message.
func Warn(msg string) {
Log.Warn(msg)
}
// Error level message.
func Error(msg string) {
Log.Error(msg)
}
// Critical level message.
func Critical(msg string) {
Log.Critical(msg)
}
// Alert level message.
func Alert(msg string) {
Log.Alert(msg)
}
// Fatal level message.
func Fatal(msg string) {
Log.Fatal(msg)
}
// Emergency level message.
func Emergency(msg string) {
Log.Emergency(msg)
}
/* END OF WARNING */
/********* End Pkg wide simple *********/
/********* Pkg wide formated *********/
/* WARNING: This part is autogenerated! Do not change! */
// Debugf level message.
func Debugf(msg string, v ...interface{}) {
Log.Debugf(msg, v...)
}
// Infof level message.
func Infof(msg string, v ...interface{}) {
Log.Infof(msg, v...)
}
// Noticef level message.
func Noticef(msg string, v ...interface{}) {
Log.Noticef(msg, v...)
}
// Warnf level message.
func Warnf(msg string, v ...interface{}) {
Log.Warnf(msg, v...)
}
// Errorf level message.
func Errorf(msg string, v ...interface{}) {
Log.Errorf(msg, v...)
}
// Criticalf level message.
func Criticalf(msg string, v ...interface{}) {
Log.Criticalf(msg, v...)
}
// Alertf level message.
func Alertf(msg string, v ...interface{}) {
Log.Alertf(msg, v...)
}
// Fatalf level message.
func Fatalf(msg string, v ...interface{}) {
Log.Fatalf(msg, v...)
}
// Emergencyf level message.
func Emergencyf(msg string, v ...interface{}) {
Log.Emergencyf(msg, v...)
}
/* END OF WARNING */
/********* End Pkg wide formated *********/
// Trace returns a new entry with a Stop method to fire off
// a corresponding completion log, useful with defer.
func Trace(msg string) *Entry {
return Log.Trace(msg)
}