...
1 package logrus
2
3 import (
4 "context"
5 "io"
6 "time"
7 )
8
9 var (
10
11 std = New()
12 )
13
14 func StandardLogger() *Logger {
15 return std
16 }
17
18
19 func SetOutput(out io.Writer) {
20 std.SetOutput(out)
21 }
22
23
24 func SetFormatter(formatter Formatter) {
25 std.SetFormatter(formatter)
26 }
27
28
29
30 func SetReportCaller(include bool) {
31 std.SetReportCaller(include)
32 }
33
34
35 func SetLevel(level Level) {
36 std.SetLevel(level)
37 }
38
39
40 func GetLevel() Level {
41 return std.GetLevel()
42 }
43
44
45 func IsLevelEnabled(level Level) bool {
46 return std.IsLevelEnabled(level)
47 }
48
49
50 func AddHook(hook Hook) {
51 std.AddHook(hook)
52 }
53
54
55 func WithError(err error) *Entry {
56 return std.WithField(ErrorKey, err)
57 }
58
59
60 func WithContext(ctx context.Context) *Entry {
61 return std.WithContext(ctx)
62 }
63
64
65
66
67
68
69 func WithField(key string, value interface{}) *Entry {
70 return std.WithField(key, value)
71 }
72
73
74
75
76
77
78
79 func WithFields(fields Fields) *Entry {
80 return std.WithFields(fields)
81 }
82
83
84
85
86
87
88 func WithTime(t time.Time) *Entry {
89 return std.WithTime(t)
90 }
91
92
93 func Trace(args ...interface{}) {
94 std.Trace(args...)
95 }
96
97
98 func Debug(args ...interface{}) {
99 std.Debug(args...)
100 }
101
102
103 func Print(args ...interface{}) {
104 std.Print(args...)
105 }
106
107
108 func Info(args ...interface{}) {
109 std.Info(args...)
110 }
111
112
113 func Warn(args ...interface{}) {
114 std.Warn(args...)
115 }
116
117
118 func Warning(args ...interface{}) {
119 std.Warning(args...)
120 }
121
122
123 func Error(args ...interface{}) {
124 std.Error(args...)
125 }
126
127
128 func Panic(args ...interface{}) {
129 std.Panic(args...)
130 }
131
132
133 func Fatal(args ...interface{}) {
134 std.Fatal(args...)
135 }
136
137
138 func TraceFn(fn LogFunction) {
139 std.TraceFn(fn)
140 }
141
142
143 func DebugFn(fn LogFunction) {
144 std.DebugFn(fn)
145 }
146
147
148 func PrintFn(fn LogFunction) {
149 std.PrintFn(fn)
150 }
151
152
153 func InfoFn(fn LogFunction) {
154 std.InfoFn(fn)
155 }
156
157
158 func WarnFn(fn LogFunction) {
159 std.WarnFn(fn)
160 }
161
162
163 func WarningFn(fn LogFunction) {
164 std.WarningFn(fn)
165 }
166
167
168 func ErrorFn(fn LogFunction) {
169 std.ErrorFn(fn)
170 }
171
172
173 func PanicFn(fn LogFunction) {
174 std.PanicFn(fn)
175 }
176
177
178 func FatalFn(fn LogFunction) {
179 std.FatalFn(fn)
180 }
181
182
183 func Tracef(format string, args ...interface{}) {
184 std.Tracef(format, args...)
185 }
186
187
188 func Debugf(format string, args ...interface{}) {
189 std.Debugf(format, args...)
190 }
191
192
193 func Printf(format string, args ...interface{}) {
194 std.Printf(format, args...)
195 }
196
197
198 func Infof(format string, args ...interface{}) {
199 std.Infof(format, args...)
200 }
201
202
203 func Warnf(format string, args ...interface{}) {
204 std.Warnf(format, args...)
205 }
206
207
208 func Warningf(format string, args ...interface{}) {
209 std.Warningf(format, args...)
210 }
211
212
213 func Errorf(format string, args ...interface{}) {
214 std.Errorf(format, args...)
215 }
216
217
218 func Panicf(format string, args ...interface{}) {
219 std.Panicf(format, args...)
220 }
221
222
223 func Fatalf(format string, args ...interface{}) {
224 std.Fatalf(format, args...)
225 }
226
227
228 func Traceln(args ...interface{}) {
229 std.Traceln(args...)
230 }
231
232
233 func Debugln(args ...interface{}) {
234 std.Debugln(args...)
235 }
236
237
238 func Println(args ...interface{}) {
239 std.Println(args...)
240 }
241
242
243 func Infoln(args ...interface{}) {
244 std.Infoln(args...)
245 }
246
247
248 func Warnln(args ...interface{}) {
249 std.Warnln(args...)
250 }
251
252
253 func Warningln(args ...interface{}) {
254 std.Warningln(args...)
255 }
256
257
258 func Errorln(args ...interface{}) {
259 std.Errorln(args...)
260 }
261
262
263 func Panicln(args ...interface{}) {
264 std.Panicln(args...)
265 }
266
267
268 func Fatalln(args ...interface{}) {
269 std.Fatalln(args...)
270 }
271
View as plain text