Documentation
¶
Index ¶
- Constants
- Variables
- func AddHook(hook Hook)
- func Debug(args ...interface{})
- func DebugFn(fn LogFunction)
- func Debugf(format string, args ...interface{})
- func Debugln(args ...interface{})
- func DeferExitHandler(handler func())
- func Error(args ...interface{})
- func ErrorFn(fn LogFunction)
- func Errorf(format string, args ...interface{})
- func Errorln(args ...interface{})
- func Exit(code int)
- func Fatal(args ...interface{})
- func FatalFn(fn LogFunction)
- func Fatalf(format string, args ...interface{})
- func Fatalln(args ...interface{})
- func Info(args ...interface{})
- func InfoFn(fn LogFunction)
- func Infof(format string, args ...interface{})
- func Infoln(args ...interface{})
- func IsLevelEnabled(level Level) bool
- func Panic(args ...interface{})
- func PanicFn(fn LogFunction)
- func Panicf(format string, args ...interface{})
- func Panicln(args ...interface{})
- func Print(args ...interface{})
- func PrintFn(fn LogFunction)
- func Printf(format string, args ...interface{})
- func Println(args ...interface{})
- func RegisterExitHandler(handler func())
- func SetBufferPool(bp BufferPool)
- func SetFormatter(formatter Formatter)
- func SetLevel(level Level)
- func SetOutput(out io.Writer)
- func SetReportCaller(include bool)
- func Trace(args ...interface{})
- func TraceFn(fn LogFunction)
- func Tracef(format string, args ...interface{})
- func Traceln(args ...interface{})
- func Warn(args ...interface{})
- func WarnFn(fn LogFunction)
- func Warnf(format string, args ...interface{})
- func Warning(args ...interface{})
- func WarningFn(fn LogFunction)
- func Warningf(format string, args ...interface{})
- func Warningln(args ...interface{})
- func Warnln(args ...interface{})
- type BufferPool
- type Entry
- func (entry *Entry) Bytes() ([]byte, error)
- func (entry *Entry) Debug(args ...interface{})
- func (entry *Entry) Debugf(format string, args ...interface{})
- func (entry *Entry) Debugln(args ...interface{})
- func (entry *Entry) Error(args ...interface{})
- func (entry *Entry) Errorf(format string, args ...interface{})
- func (entry *Entry) Errorln(args ...interface{})
- func (entry *Entry) Fatal(args ...interface{})
- func (entry *Entry) Fatalf(format string, args ...interface{})
- func (entry *Entry) Fatalln(args ...interface{})
- func (entry Entry) HasCaller() (has bool)
- func (entry *Entry) Info(args ...interface{})
- func (entry *Entry) Infof(format string, args ...interface{})
- func (entry *Entry) Infoln(args ...interface{})
- func (entry *Entry) Log(level Level, args ...interface{})
- func (entry *Entry) Logf(level Level, format string, args ...interface{})
- func (entry *Entry) Logln(level Level, args ...interface{})
- func (entry *Entry) Panic(args ...interface{})
- func (entry *Entry) Panicf(format string, args ...interface{})
- func (entry *Entry) Panicln(args ...interface{})
- func (entry *Entry) Print(args ...interface{})
- func (entry *Entry) Printf(format string, args ...interface{})
- func (entry *Entry) Println(args ...interface{})
- func (entry *Entry) String() (string, error)
- func (entry *Entry) Trace(args ...interface{})
- func (entry *Entry) Tracef(format string, args ...interface{})
- func (entry *Entry) Traceln(args ...interface{})
- func (entry *Entry) Warn(args ...interface{})
- func (entry *Entry) Warnf(format string, args ...interface{})
- func (entry *Entry) Warning(args ...interface{})
- func (entry *Entry) Warningf(format string, args ...interface{})
- func (entry *Entry) Warningln(args ...interface{})
- func (entry *Entry) Warnln(args ...interface{})
- func (entry *Entry) WithContext(ctx context.Context) *Entry
- func (entry *Entry) WithError(err error) *Entry
- func (entry *Entry) WithField(key string, value interface{}) *Entry
- func (entry *Entry) WithFields(fields ...interface{}) *Entry
- func (entry *Entry) WithTime(t time.Time) *Entry
- func (entry *Entry) Writer() *io.PipeWriter
- func (entry *Entry) WriterLevel(level Level) *io.PipeWriter
- type FieldKey
- type FieldLogger
- type FieldMap
- type Fields
- type Formatter
- type Hook
- type JSONFormatter
- type Level
- type LevelHooks
- type LogFunction
- type Logger
- func (logger *Logger) AddHook(hook Hook)
- func (logger *Logger) Debug(args ...interface{})
- func (logger *Logger) DebugFn(fn LogFunction)
- func (logger *Logger) Debugf(format string, args ...interface{})
- func (logger *Logger) Debugln(args ...interface{})
- func (logger *Logger) Error(args ...interface{})
- func (logger *Logger) ErrorFn(fn LogFunction)
- func (logger *Logger) Errorf(format string, args ...interface{})
- func (logger *Logger) Errorln(args ...interface{})
- func (logger *Logger) Exit(code int)
- func (logger *Logger) Fatal(args ...interface{})
- func (logger *Logger) FatalFn(fn LogFunction)
- func (logger *Logger) Fatalf(format string, args ...interface{})
- func (logger *Logger) Fatalln(args ...interface{})
- func (logger *Logger) GetLevel() Level
- func (logger *Logger) Info(args ...interface{})
- func (logger *Logger) InfoFn(fn LogFunction)
- func (logger *Logger) Infof(format string, args ...interface{})
- func (logger *Logger) Infoln(args ...interface{})
- func (logger *Logger) IsLevelEnabled(level Level) bool
- func (logger *Logger) Log(level Level, args ...interface{})
- func (logger *Logger) LogFn(level Level, fn LogFunction)
- func (logger *Logger) Logf(level Level, format string, args ...interface{})
- func (logger *Logger) Logln(level Level, args ...interface{})
- func (logger *Logger) Panic(args ...interface{})
- func (logger *Logger) PanicFn(fn LogFunction)
- func (logger *Logger) Panicf(format string, args ...interface{})
- func (logger *Logger) Panicln(args ...interface{})
- func (logger *Logger) Print(args ...interface{})
- func (logger *Logger) PrintFn(fn LogFunction)
- func (logger *Logger) Printf(format string, args ...interface{})
- func (logger *Logger) Println(args ...interface{})
- func (logger *Logger) ReplaceHooks(hooks LevelHooks) LevelHooks
- func (logger *Logger) SetErrorOutput(output io.Writer)
- func (logger *Logger) SetFormatter(formatter Formatter)
- func (logger *Logger) SetLevel(level Level)
- func (logger *Logger) SetNoLock()
- func (logger *Logger) SetOutput(output io.Writer)
- func (logger *Logger) SetReportCaller(reportCaller bool)
- func (logger *Logger) Trace(args ...interface{})
- func (logger *Logger) TraceFn(fn LogFunction)
- func (logger *Logger) Tracef(format string, args ...interface{})
- func (logger *Logger) Traceln(args ...interface{})
- func (logger *Logger) Warn(args ...interface{})
- func (logger *Logger) WarnFn(fn LogFunction)
- func (logger *Logger) Warnf(format string, args ...interface{})
- func (logger *Logger) Warning(args ...interface{})
- func (logger *Logger) WarningFn(fn LogFunction)
- func (logger *Logger) Warningf(format string, args ...interface{})
- func (logger *Logger) Warningln(args ...interface{})
- func (logger *Logger) Warnln(args ...interface{})
- func (logger *Logger) WithContext(ctx context.Context) *Entry
- func (logger *Logger) WithError(err error) *Entry
- func (logger *Logger) WithField(key string, value interface{}) *Entry
- func (logger *Logger) WithFields(fields ...interface{}) *Entry
- func (logger *Logger) WithTime(t time.Time) *Entry
- func (logger *Logger) Writer() *io.PipeWriter
- func (logger *Logger) WriterLevel(level Level) *io.PipeWriter
- type MutexWrap
- type StdLogger
- type TextFormatter
Constants ¶
View Source
const ( FieldKeyMsg = "msg" FieldKeyLevel = "level" FieldKeyTime = "time" FieldKeyLogrusError = "logrus_error" FieldKeyFunc = "func" FieldKeyFile = "file" )
Default key names ...
Variables ¶
View Source
var AllLevels = []Level{ PanicLevel, FatalLevel, ErrorLevel, WarnLevel, InfoLevel, DebugLevel, TraceLevel, }
AllLevels ...
View Source
var ErrorKey = "error"
ErrorKey ...
Functions ¶
Types ¶
type Entry ¶
type Entry struct {
Logger *Logger
Data Fields
Time time.Time
Level Level
Caller *runtime.Frame
Message string
Buffer *bytes.Buffer
Context context.Context
}
Entry ...
func (*Entry) WithContext ¶
WithContext ...
func (*Entry) WithFields ¶
WithFields ...
func (*Entry) WriterLevel ¶
func (entry *Entry) WriterLevel(level Level) *io.PipeWriter
WriterLevel ...
type FieldLogger ¶
type FieldLogger interface {
WithField(key string, value interface{}) *Entry
WithFields(fields ...interface{}) *Entry
WithError(err error) *Entry
Debugf(format string, args ...interface{})
Infof(format string, args ...interface{})
Printf(format string, args ...interface{})
Warnf(format string, args ...interface{})
Warningf(format string, args ...interface{})
Errorf(format string, args ...interface{})
Fatalf(format string, args ...interface{})
Panicf(format string, args ...interface{})
Debug(args ...interface{})
Info(args ...interface{})
Print(args ...interface{})
Warn(args ...interface{})
Warning(args ...interface{})
Error(args ...interface{})
Fatal(args ...interface{})
Panic(args ...interface{})
Debugln(args ...interface{})
Infoln(args ...interface{})
Println(args ...interface{})
Warnln(args ...interface{})
Warningln(args ...interface{})
Errorln(args ...interface{})
Fatalln(args ...interface{})
Panicln(args ...interface{})
}
FieldLogger ...
type JSONFormatter ¶
type JSONFormatter struct {
TimestampFormat string
DisableTimestamp bool
DisableHTMLEscape bool
DataKey string
FieldMap FieldMap
CallerPrettyfier func(*runtime.Frame) (function string, file string)
PrettyPrint bool
}
JSONFormatter ...
type Level ¶
type Level uint32
Level ...
Levels ...
func (Level) MarshalText ¶
func (*Level) UnmarshalText ¶
UnmarshalText ...
type LevelHooks ¶
LevelHooks ...
type Logger ¶
type Logger struct {
Out io.Writer
ErrorOut io.Writer
Hooks LevelHooks
Formatter Formatter
ReportCaller bool
Level Level
ExitFunc exitFunc
// contains filtered or unexported fields
}
func StandardLogger ¶
func StandardLogger() *Logger
func (*Logger) DebugFn ¶
func (logger *Logger) DebugFn(fn LogFunction)
func (*Logger) ErrorFn ¶
func (logger *Logger) ErrorFn(fn LogFunction)
func (*Logger) FatalFn ¶
func (logger *Logger) FatalFn(fn LogFunction)
func (*Logger) InfoFn ¶
func (logger *Logger) InfoFn(fn LogFunction)
func (*Logger) IsLevelEnabled ¶
IsLevelEnabled ...
func (*Logger) LogFn ¶
func (logger *Logger) LogFn(level Level, fn LogFunction)
func (*Logger) PanicFn ¶
func (logger *Logger) PanicFn(fn LogFunction)
func (*Logger) PrintFn ¶
func (logger *Logger) PrintFn(fn LogFunction)
func (*Logger) ReplaceHooks ¶
func (logger *Logger) ReplaceHooks(hooks LevelHooks) LevelHooks
ReplaceHooks ...
func (*Logger) SetErrorOutput ¶
SetErrorOutput ...
func (*Logger) SetFormatter ¶
SetFormatter ...
func (*Logger) SetNoLock ¶
func (logger *Logger) SetNoLock()
When file is opened with appending mode, it's safe to write concurrently to a file (within 4k message on Linux). In these cases user can choose to disable the lock.
func (*Logger) SetReportCaller ¶
SetReportCaller ...
func (*Logger) TraceFn ¶
func (logger *Logger) TraceFn(fn LogFunction)
func (*Logger) WarnFn ¶
func (logger *Logger) WarnFn(fn LogFunction)
func (*Logger) WarningFn ¶
func (logger *Logger) WarningFn(fn LogFunction)
func (*Logger) WithContext ¶
WithContext ...
func (*Logger) WithFields ¶
WithFields ...
func (*Logger) WriterLevel ¶
func (logger *Logger) WriterLevel(level Level) *io.PipeWriter
WriterLevel ...
type StdLogger ¶
type StdLogger interface {
Print(...interface{})
Printf(string, ...interface{})
Println(...interface{})
Fatal(...interface{})
Fatalf(string, ...interface{})
Fatalln(...interface{})
Panic(...interface{})
Panicf(string, ...interface{})
Panicln(...interface{})
}
StdLogger ...
type TextFormatter ¶
type TextFormatter struct {
ForceColors bool
DisableColors bool
ForceQuote bool
DisableQuote bool
EnvironmentOverrideColors bool
DisableTimestamp bool
FullTimestamp bool
TimestampFormat string
DisableSorting bool
SortingFunc func([]string)
DisableLevelTruncation bool
PadLevelText bool
QuoteEmptyFields bool
FieldMap FieldMap
CallerPrettyfier func(*runtime.Frame) (function string, file string)
}
TextFormatter ...
Source Files
¶
Click to show internal directories.
Click to hide internal directories.