8 // std is the name of the standard logger in stdlib `log`
12 func StandardLogger() *Logger {
16 // SetOutput sets the standard logger output.
17 func SetOutput(out io.Writer) {
23 // SetFormatter sets the standard logger formatter.
24 func SetFormatter(formatter Formatter) {
27 std.Formatter = formatter
30 // SetLevel sets the standard logger level.
31 func SetLevel(level Level) {
37 // GetLevel returns the standard logger level.
38 func GetLevel() Level {
44 // AddHook adds a hook to the standard logger hooks.
45 func AddHook(hook Hook) {
51 // WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key.
52 func WithError(err error) *Entry {
53 return std.WithField(ErrorKey, err)
56 // WithField creates an entry from the standard logger and adds a field to
57 // it. If you want multiple fields, use `WithFields`.
59 // Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
60 // or Panic on the Entry it returns.
61 func WithField(key string, value interface{}) *Entry {
62 return std.WithField(key, value)
65 // WithFields creates an entry from the standard logger and adds multiple
66 // fields to it. This is simply a helper for `WithField`, invoking it
67 // once for each field.
69 // Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
70 // or Panic on the Entry it returns.
71 func WithFields(fields Fields) *Entry {
72 return std.WithFields(fields)
75 // Debug logs a message at level Debug on the standard logger.
76 func Debug(args ...interface{}) {
80 // Print logs a message at level Info on the standard logger.
81 func Print(args ...interface{}) {
85 // Info logs a message at level Info on the standard logger.
86 func Info(args ...interface{}) {
90 // Warn logs a message at level Warn on the standard logger.
91 func Warn(args ...interface{}) {
95 // Warning logs a message at level Warn on the standard logger.
96 func Warning(args ...interface{}) {
100 // Error logs a message at level Error on the standard logger.
101 func Error(args ...interface{}) {
105 // Panic logs a message at level Panic on the standard logger.
106 func Panic(args ...interface{}) {
110 // Fatal logs a message at level Fatal on the standard logger.
111 func Fatal(args ...interface{}) {
115 // Debugf logs a message at level Debug on the standard logger.
116 func Debugf(format string, args ...interface{}) {
117 std.Debugf(format, args...)
120 // Printf logs a message at level Info on the standard logger.
121 func Printf(format string, args ...interface{}) {
122 std.Printf(format, args...)
125 // Infof logs a message at level Info on the standard logger.
126 func Infof(format string, args ...interface{}) {
127 std.Infof(format, args...)
130 // Warnf logs a message at level Warn on the standard logger.
131 func Warnf(format string, args ...interface{}) {
132 std.Warnf(format, args...)
135 // Warningf logs a message at level Warn on the standard logger.
136 func Warningf(format string, args ...interface{}) {
137 std.Warningf(format, args...)
140 // Errorf logs a message at level Error on the standard logger.
141 func Errorf(format string, args ...interface{}) {
142 std.Errorf(format, args...)
145 // Panicf logs a message at level Panic on the standard logger.
146 func Panicf(format string, args ...interface{}) {
147 std.Panicf(format, args...)
150 // Fatalf logs a message at level Fatal on the standard logger.
151 func Fatalf(format string, args ...interface{}) {
152 std.Fatalf(format, args...)
155 // Debugln logs a message at level Debug on the standard logger.
156 func Debugln(args ...interface{}) {
160 // Println logs a message at level Info on the standard logger.
161 func Println(args ...interface{}) {
165 // Infoln logs a message at level Info on the standard logger.
166 func Infoln(args ...interface{}) {
170 // Warnln logs a message at level Warn on the standard logger.
171 func Warnln(args ...interface{}) {
175 // Warningln logs a message at level Warn on the standard logger.
176 func Warningln(args ...interface{}) {
177 std.Warningln(args...)
180 // Errorln logs a message at level Error on the standard logger.
181 func Errorln(args ...interface{}) {
185 // Panicln logs a message at level Panic on the standard logger.
186 func Panicln(args ...interface{}) {
190 // Fatalln logs a message at level Fatal on the standard logger.
191 func Fatalln(args ...interface{}) {