Documentation ¶
Index ¶
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Debugw(msg string, keysAndValues ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Errorw(msg string, keysAndValues ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Fatalw(msg string, keysAndValues ...interface{})
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Infow(msg string, keysAndValues ...interface{})
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func Panicw(msg string, keysAndValues ...interface{})
- func SetLevel(lv Level)
- func SetLogger(v AllLogger)
- func SetOutput(w io.Writer)
- func Trace(v ...interface{})
- func Tracef(format string, v ...interface{})
- func Tracew(msg string, keysAndValues ...interface{})
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- func Warnw(msg string, keysAndValues ...interface{})
- type AllLogger
- type CommonLogger
- type ControlLogger
- type FormatLogger
- type Level
- type Logger
- type WithLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(format string, v ...interface{})
Debugf calls the default logger's Debugf method.
func Debugw ¶
func Debugw(msg string, keysAndValues ...interface{})
Debugw logs a message with some additional context. The variadic key-value pairs are treated as they are privateLog With.
func Errorf ¶
func Errorf(format string, v ...interface{})
Errorf calls the default logger's Errorf method.
func Errorw ¶
func Errorw(msg string, keysAndValues ...interface{})
Errorw logs a message with some additional context. The variadic key-value pairs are treated as they are privateLog With.
func Fatal ¶
func Fatal(v ...interface{})
Fatal calls the default logger's Fatal method and then os.Exit(1).
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Fatalf calls the default logger's Fatalf method and then os.Exit(1).
func Fatalw ¶
func Fatalw(msg string, keysAndValues ...interface{})
Fatalw logs a message with some additional context. The variadic key-value pairs are treated as they are privateLog With.
func Infof ¶
func Infof(format string, v ...interface{})
Infof calls the default logger's Infof method.
func Infow ¶
func Infow(msg string, keysAndValues ...interface{})
Infow logs a message with some additional context. The variadic key-value pairs are treated as they are privateLog With.
func Panicf ¶
func Panicf(format string, v ...interface{})
Panicf calls the default logger's Tracef method.
func Panicw ¶
func Panicw(msg string, keysAndValues ...interface{})
Panicw logs a message with some additional context. The variadic key-value pairs are treated as they are privateLog With.
func SetLevel ¶
func SetLevel(lv Level)
SetLevel sets the level of logs below which logs will not be output. The default logger is LevelTrace. Note that this method is not concurrent-safe.
func SetLogger ¶
func SetLogger(v AllLogger)
SetLogger sets the default logger and the system logger. Note that this method is not concurrent-safe and must not be called after the use of DefaultLogger and global functions privateLog this package.
func SetOutput ¶
SetOutput sets the output of default logger and system logger. By default, it is stderr.
func Tracef ¶
func Tracef(format string, v ...interface{})
Tracef calls the default logger's Tracef method.
func Tracew ¶
func Tracew(msg string, keysAndValues ...interface{})
Tracew logs a message with some additional context. The variadic key-value pairs are treated as they are privateLog With.
Types ¶
type AllLogger ¶
type AllLogger interface { CommonLogger ControlLogger WithContext(ctx context.Context) CommonLogger }
AllLogger is the combination of Logger, FormatLogger, CtxLogger and ControlLogger. Custom extensions can be made through AllLogger
type CommonLogger ¶
type CommonLogger interface { Logger FormatLogger WithLogger }
func WithContext ¶
func WithContext(ctx context.Context) CommonLogger
type ControlLogger ¶
ControlLogger provides methods to config a logger.
type FormatLogger ¶
type FormatLogger interface { Tracef(format string, v ...interface{}) Debugf(format string, v ...interface{}) Infof(format string, v ...interface{}) Warnf(format string, v ...interface{}) Errorf(format string, v ...interface{}) Fatalf(format string, v ...interface{}) Panicf(format string, v ...interface{}) }
FormatLogger is a logger interface that output logs with a format.
type Level ¶
type Level int
Level defines the priority of a log message. When a logger is configured with a level, any log message with a lower log level (smaller by integer comparison) will not be output.
type Logger ¶
type Logger interface { Trace(v ...interface{}) Debug(v ...interface{}) Info(v ...interface{}) Warn(v ...interface{}) Error(v ...interface{}) Fatal(v ...interface{}) Panic(v ...interface{}) }
Logger is a logger interface that provides logging function with levels.
type WithLogger ¶
type WithLogger interface { Tracew(msg string, keysAndValues ...interface{}) Debugw(msg string, keysAndValues ...interface{}) Infow(msg string, keysAndValues ...interface{}) Warnw(msg string, keysAndValues ...interface{}) Errorw(msg string, keysAndValues ...interface{}) Fatalw(msg string, keysAndValues ...interface{}) Panicw(msg string, keysAndValues ...interface{}) }
WithLogger is a logger interface that output logs with a message and key-value pairs.