Debian Codegraph @

vendor/github.com/sirupsen/logrus/exported.go

raw
1 package logrus
2
3 import (
4 "io"
5 "time"
6 )
7
8 var (
9 // std is the name of the standard logger in stdlib `log`
10 std = New()
11 )
12
13 func StandardLogger() *Logger {
14 return std
15 }
16
17 // SetOutput sets the standard logger output.
18 func SetOutput(out io.Writer) {
19 std.SetOutput(out)
20 }
21
22 // SetFormatter sets the standard logger formatter.
23 func SetFormatter(formatter Formatter) {
24 std.mu.Lock()
25 defer std.mu.Unlock()
26 std.Formatter = formatter
27 }
28
29 // SetLevel sets the standard logger level.
30 func SetLevel(level Level) {
31 std.mu.Lock()
32 defer std.mu.Unlock()
33 std.SetLevel(level)
34 }
35
36 // GetLevel returns the standard logger level.
37 func GetLevel() Level {
38 std.mu.Lock()
39 defer std.mu.Unlock()
40 return std.level()
41 }
42
43 // AddHook adds a hook to the standard logger hooks.
44 func AddHook(hook Hook) {
45 std.mu.Lock()
46 defer std.mu.Unlock()
47 std.Hooks.Add(hook)
48 }
49
50 // WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key.
51 func WithError(err error) *Entry {
52 return std.WithField(ErrorKey, err)
53 }
54
55 // WithField creates an entry from the standard logger and adds a field to
56 // it. If you want multiple fields, use `WithFields`.
57 //
58 // Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
59 // or Panic on the Entry it returns.
60 func WithField(key string, value interface{}) *Entry {
61 return std.WithField(key, value)
62 }
63
64 // WithFields creates an entry from the standard logger and adds multiple
65 // fields to it. This is simply a helper for `WithField`, invoking it
66 // once for each field.
67 //
68 // Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
69 // or Panic on the Entry it returns.
70 func WithFields(fields Fields) *Entry {
71 return std.WithFields(fields)
72 }
73
74 // WithTime creats an entry from the standard logger and overrides the time of
75 // logs generated with it.
76 //
77 // Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
78 // or Panic on the Entry it returns.
79 func WithTime(t time.Time) *Entry {
80 return std.WithTime(t)
81 }
82
83 // Debug logs a message at level Debug on the standard logger.
84 func Debug(args ...interface{}) {
85 std.Debug(args...)
86 }
87
88 // Print logs a message at level Info on the standard logger.
89 func Print(args ...interface{}) {
90 std.Print(args...)
91 }
92
93 // Info logs a message at level Info on the standard logger.
94 func Info(args ...interface{}) {
95 std.Info(args...)
96 }
97
98 // Warn logs a message at level Warn on the standard logger.
99 func Warn(args ...interface{}) {
100 std.Warn(args...)
101 }
102
103 // Warning logs a message at level Warn on the standard logger.
104 func Warning(args ...interface{}) {
105 std.Warning(args...)
106 }
107
108 // Error logs a message at level Error on the standard logger.
109 func Error(args ...interface{}) {
110 std.Error(args...)
111 }
112
113 // Panic logs a message at level Panic on the standard logger.
114 func Panic(args ...interface{}) {
115 std.Panic(args...)
116 }
117
118 // Fatal logs a message at level Fatal on the standard logger then the process will exit with status set to 1.
119 func Fatal(args ...interface{}) {
120 std.Fatal(args...)
121 }
122
123 // Debugf logs a message at level Debug on the standard logger.
124 func Debugf(format string, args ...interface{}) {
125 std.Debugf(format, args...)
126 }
127
128 // Printf logs a message at level Info on the standard logger.
129 func Printf(format string, args ...interface{}) {
130 std.Printf(format, args...)
131 }
132
133 // Infof logs a message at level Info on the standard logger.
134 func Infof(format string, args ...interface{}) {
135 std.Infof(format, args...)
136 }
137
138 // Warnf logs a message at level Warn on the standard logger.
139 func Warnf(format string, args ...interface{}) {
140 std.Warnf(format, args...)
141 }
142
143 // Warningf logs a message at level Warn on the standard logger.
144 func Warningf(format string, args ...interface{}) {
145 std.Warningf(format, args...)
146 }
147
148 // Errorf logs a message at level Error on the standard logger.
149 func Errorf(format string, args ...interface{}) {
150 std.Errorf(format, args...)
151 }
152
153 // Panicf logs a message at level Panic on the standard logger.
154 func Panicf(format string, args ...interface{}) {
155 std.Panicf(format, args...)
156 }
157
158 // Fatalf logs a message at level Fatal on the standard logger then the process will exit with status set to 1.
159 func Fatalf(format string, args ...interface{}) {
160 std.Fatalf(format, args...)
161 }
162
163 // Debugln logs a message at level Debug on the standard logger.
164 func Debugln(args ...interface{}) {
165 std.Debugln(args...)
166 }
167
168 // Println logs a message at level Info on the standard logger.
169 func Println(args ...interface{}) {
170 std.Println(args...)
171 }
172
173 // Infoln logs a message at level Info on the standard logger.
174 func Infoln(args ...interface{}) {
175 std.Infoln(args...)
176 }
177
178 // Warnln logs a message at level Warn on the standard logger.
179 func Warnln(args ...interface{}) {
180 std.Warnln(args...)
181 }
182
183 // Warningln logs a message at level Warn on the standard logger.
184 func Warningln(args ...interface{}) {
185 std.Warningln(args...)
186 }
187
188 // Errorln logs a message at level Error on the standard logger.
189 func Errorln(args ...interface{}) {
190 std.Errorln(args...)
191 }
192
193 // Panicln logs a message at level Panic on the standard logger.
194 func Panicln(args ...interface{}) {
195 std.Panicln(args...)
196 }
197
198 // Fatalln logs a message at level Fatal on the standard logger then the process will exit with status set to 1.
199 func Fatalln(args ...interface{}) {
200 std.Fatalln(args...)
201 }