Documentation ¶
Index ¶
- type Config
- type Flags
- type Logger
- func (l *Logger) Debug(a ...interface{})
- func (l *Logger) DebugKVs(fields ...kv.Field)
- func (l *Logger) Debugf(s string, a ...interface{})
- func (l *Logger) Entry(calldepth int) *entry.Entry
- func (l *Logger) Error(a ...interface{})
- func (l *Logger) ErrorKVs(fields ...kv.Field)
- func (l *Logger) Errorf(s string, a ...interface{})
- func (l *Logger) Fatal(a ...interface{})
- func (l *Logger) FatalKVs(fields ...kv.Field)
- func (l *Logger) Fatalf(s string, a ...interface{})
- func (l *Logger) Flags() Flags
- func (l *Logger) Info(a ...interface{})
- func (l *Logger) InfoKVs(fields ...kv.Field)
- func (l *Logger) Infof(s string, a ...interface{})
- func (l *Logger) Level() level.LEVEL
- func (l *Logger) Log(calldepth int, lvl level.LEVEL, a ...interface{})
- func (l *Logger) LogKVs(calldepth int, lvl level.LEVEL, fields ...kv.Field)
- func (l *Logger) Logf(calldepth int, lvl level.LEVEL, s string, a ...interface{})
- func (l *Logger) Panic(a ...interface{})
- func (l *Logger) PanicKVs(fields ...kv.Field)
- func (l *Logger) Panicf(s string, a ...interface{})
- func (l *Logger) Print(a ...interface{})
- func (l *Logger) PrintKVs(fields ...kv.Field)
- func (l *Logger) Printf(s string, a ...interface{})
- func (l *Logger) SetFlags(flags Flags)
- func (l *Logger) SetLevel(lvl level.LEVEL)
- func (l *Logger) SetOutput(out io.Writer)
- func (l *Logger) Trace(a ...interface{})
- func (l *Logger) TraceKVs(fields ...kv.Field)
- func (l *Logger) Tracef(s string, a ...interface{})
- func (l *Logger) Warn(a ...interface{})
- func (l *Logger) WarnKVs(fields ...kv.Field)
- func (l *Logger) Warnf(s string, a ...interface{})
- func (l *Logger) Write(entry *entry.Entry)
- func (l *Logger) Writer() io.Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // FlagHandler handles any necessary tasks to perform on an Entry // given the provided flags. Calldepth is provided for logger.FCaller. FlagHandler func(entry *entry.Entry, calldepth int, flags Flags) // Format provides formatting for Entries produced from Logger. Format entry.Formatter // Calldepth allows setting a minimum calldepth for log entries when // calling functions that internally set a calldepth e.g. .Print(), // though will not effect functions that accept a calldepth argument. // This is useful when wrapping Logger. Calldepth int }
Config provides entry format configuration for a Logger.
type Flags ¶ added in v2.0.2
type Flags bitutil.Flags16
Flags provides configurable output flags for Logger.
func (Flags) UnsetCaller ¶ added in v2.0.2
UnsetCaller will unset the Caller flag bit.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is an object that provides logging to an io.Writer output with levels and many formatting options. Each log entry is written to the output by a singular .Write() call.
func NewWith ¶
NewWith returns a new Logger instance with given configuration, logging level and log flags.
func (*Logger) DebugKVs ¶
func (l *Logger) DebugKVs(fields ...kv.Field)
DebugKVs: see Logger.LogKVs.
func (*Logger) Entry ¶
Entry will acquire a log entry from memory pool and append any information required by log flags using Config.FlagHandler(). This is valid until passed to Logger.Write().
func (*Logger) ErrorKVs ¶
func (l *Logger) ErrorKVs(fields ...kv.Field)
ErrorKVs: see Logger.LogKVs.
func (*Logger) Fatal ¶
func (l *Logger) Fatal(a ...interface{})
Fatal: see Logger.Log. Aftward, exits with `defer syscall.Exit(1)`.
func (*Logger) FatalKVs ¶
func (l *Logger) FatalKVs(fields ...kv.Field)
FatalKVs: see Logger.LogKVs. Aftward, exits with `defer syscall.Exit(1)`.
func (*Logger) Log ¶
Log writes provided args to the log output at provided log level. Calldepth determines number of frames to skip when .FCaller is enabled and calculating stack frames.
func (*Logger) LogKVs ¶
LogKVs writes provided key-value fields to the log output. Calldepth determines number of frames to skip when .FCaller is enabled and calculating stack frames.
func (*Logger) Logf ¶
Logf writes provided format string and args to the log output. Calldepth determines number of frames to skip when .FCaller is enabled and calculating stack frames.
func (*Logger) Panic ¶
func (l *Logger) Panic(a ...interface{})
Panic: see Logger.Log. Aftward, exits with `defer panic(fmt.Sprintf(a...))`.
func (*Logger) PanicKVs ¶
func (l *Logger) PanicKVs(fields ...kv.Field)
PanicKVs: see Logger.LogKVs. Aftward, exits with `defer panic(fmt.Sprintf(a...))`.
func (*Logger) Panicf ¶
Panicf: see Logger.Logf. Aftward, exits with `defer panic(fmt.Sprintf(a...))`.
func (*Logger) Print ¶
func (l *Logger) Print(a ...interface{})
Print writes provided args to the log output.
func (*Logger) PrintKVs ¶
func (l *Logger) PrintKVs(fields ...kv.Field)
PrintKVs writes provided key-value fields to the log output.
func (*Logger) Trace ¶ added in v2.0.6
func (l *Logger) Trace(a ...interface{})
Trace: see Logger.Log.
func (*Logger) TraceKVs ¶ added in v2.0.6
func (l *Logger) TraceKVs(fields ...kv.Field)
TraceKVs: see Logger.LogKVs.