Documentation ¶
Index ¶
- Constants
- func FormatLog(f interface{}, v ...interface{}) string
- func GetLogLevel(logLevelName string) logrus.Level
- type CallerHook
- type LogrusLogger
- func (l *LogrusLogger) Debug(f interface{}, args ...interface{})
- func (l *LogrusLogger) Debugln(v ...interface{})
- func (l *LogrusLogger) Error(f interface{}, args ...interface{})
- func (l *LogrusLogger) Errorln(args ...interface{})
- func (l *LogrusLogger) Fatal(f interface{}, args ...interface{})
- func (l *LogrusLogger) Fatalln(args ...interface{})
- func (l *LogrusLogger) GetLogger() *logrus.Logger
- func (l *LogrusLogger) Info(f interface{}, args ...interface{})
- func (l *LogrusLogger) Infoln(args ...interface{})
- func (l *LogrusLogger) Panic(f interface{}, args ...interface{})
- func (l *LogrusLogger) Panicln(args ...interface{})
- func (l *LogrusLogger) Printf(f interface{}, args ...interface{})
- func (l *LogrusLogger) Printfln(args ...interface{})
- func (l *LogrusLogger) Warn(f interface{}, args ...interface{})
- func (l *LogrusLogger) Warnln(args ...interface{})
- type Options
Constants ¶
const ( // PanicLevel level, highest level of severity. Logs and then calls panic with the // message passed to Debug, Info, ... PanicLevel logrus.Level = iota // FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the // logging level is set to Panic. FatalLevel // ErrorLevel level. Logs. Used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. ErrorLevel // WarnLevel level. Non-critical entries that deserve eyes. WarnLevel // InfoLevel level. General operational entries about what's going on inside the // application. InfoLevel // DebugLevel level. Usually only enabled when debugging. Very verbose logging. DebugLevel )
Variables ¶
This section is empty.
Functions ¶
func GetLogLevel ¶
GetLogLevel get the logLevel from logLevelName
Types ¶
type CallerHook ¶
type CallerHook struct {
// contains filtered or unexported fields
}
CallerHook a caller hook of logrus
func (*CallerHook) Fire ¶
func (hook *CallerHook) Fire(entry *logrus.Entry) error
Fire adds a caller field in logger instance
func (*CallerHook) Levels ¶
func (hook *CallerHook) Levels() []logrus.Level
Levels returns supported levels
type LogrusLogger ¶
type LogrusLogger struct {
// contains filtered or unexported fields
}
LogrusLogger logrus logger
func GetLoggerWithOptions ¶
func GetLoggerWithOptions(logName string, options *Options) *LogrusLogger
GetLoggerWithOptions with options config
func (*LogrusLogger) Debug ¶
func (l *LogrusLogger) Debug(f interface{}, args ...interface{})
Debug wrapper Debug logger
func (*LogrusLogger) Debugln ¶
func (l *LogrusLogger) Debugln(v ...interface{})
Debugln wrapper Debugln logger
func (*LogrusLogger) Error ¶
func (l *LogrusLogger) Error(f interface{}, args ...interface{})
Error wrapper Error logger
func (*LogrusLogger) Errorln ¶
func (l *LogrusLogger) Errorln(args ...interface{})
Errorln wrapper Errorln logger
func (*LogrusLogger) Fatal ¶
func (l *LogrusLogger) Fatal(f interface{}, args ...interface{})
Fatal wrapper Fatal logger
func (*LogrusLogger) Fatalln ¶
func (l *LogrusLogger) Fatalln(args ...interface{})
Fatalln wrapper Fatalln logger
func (*LogrusLogger) GetLogger ¶
func (l *LogrusLogger) GetLogger() *logrus.Logger
GetLogger convert LogrusLogger to *logrus.Logger
func (*LogrusLogger) Info ¶
func (l *LogrusLogger) Info(f interface{}, args ...interface{})
Info wrapper Info logger
func (*LogrusLogger) Infoln ¶
func (l *LogrusLogger) Infoln(args ...interface{})
Infoln wrapper Infoln logger
func (*LogrusLogger) Panic ¶
func (l *LogrusLogger) Panic(f interface{}, args ...interface{})
Panic wrapper Panic logger
func (*LogrusLogger) Panicln ¶
func (l *LogrusLogger) Panicln(args ...interface{})
Panicln wrapper Panicln logger
func (*LogrusLogger) Printf ¶
func (l *LogrusLogger) Printf(f interface{}, args ...interface{})
Printf wrapper Printf logger
func (*LogrusLogger) Printfln ¶
func (l *LogrusLogger) Printfln(args ...interface{})
Printfln wrapper Printfln logger
func (*LogrusLogger) Warn ¶
func (l *LogrusLogger) Warn(f interface{}, args ...interface{})
Warn wrapper Warn logger
func (*LogrusLogger) Warnln ¶
func (l *LogrusLogger) Warnln(args ...interface{})
Warnln wrapper Warnln logger
type Options ¶
type Options struct { Level string Depth int WithCallerHook bool Formatter string // only support json and text DisableConsole bool Write bool Path string FileName string MaxAge time.Duration RotationCount uint // can`t be set with maxAge at the same time RotationTime time.Duration Debug bool // if set true, separate }
Options logger options config