Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func New(opts ...OptionFunc) *logger
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func SetStdOptions(opts ...OptionFunc)
- func StdLogger() *logger
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Writer() io.Writer
- type Attribute
- type Entry
- type Formatter
- type Hook
- type HookGroup
- type Level
- type OptionFunc
- func WithDisPlayLevel(level Level) OptionFunc
- func WithDisableCaller(caller bool) OptionFunc
- func WithFormatter(formatter Formatter) OptionFunc
- func WithHook(level Level, hook Hook) OptionFunc
- func WithHookGroup(logLevel Level, hooks ...Hook) OptionFunc
- func WithLogLevelColor(level Level, font Attribute) OptionFunc
- func WithOutput(op io.Writer) OptionFunc
- func WithStdDisPlayLevel(level Level) OptionFunc
- type SimpleHook
- type TextFormatter
Constants ¶
View Source
const ( DebugLevel = 1 << 0 InfoLevel = 1 << 1 WarnLevel = 1 << 2 ErrorLevel = 1 << 3 PanicLevel = 1 << 4 FatalLevel = 1 << 5 )
View Source
const (
FmtEmptySeparate = ""
)
Variables ¶
View Source
var LevelNameMapping = map[Level]string{ DebugLevel: "DEBUG", InfoLevel: "INFO", WarnLevel: "WARN", ErrorLevel: "ERROR", PanicLevel: "PANIC", FatalLevel: "FATAL", }
Functions ¶
func New ¶
func New(opts ...OptionFunc) *logger
Types ¶
type Attribute ¶
const ( Reset Attribute = iota Bold Faint Italic Underline BlinkSlow BlinkRapid ReverseVideo Concealed CrossedOut )
Base attributes
Foreground text colors
const ( FgHiBlack Attribute = iota + 90 FgHiRed FgHiGreen FgHiYellow FgHiBlue FgHiMagenta FgHiCyan FgHiWhite )
Foreground Hi-Intensity text colors
Background text colors
type Entry ¶
type Hook ¶
type HookGroup ¶
type HookGroup struct {
// contains filtered or unexported fields
}
更高级的 hook,用来直接处理一组 hook
type OptionFunc ¶
type OptionFunc func(*options)
func WithDisPlayLevel ¶
func WithDisPlayLevel(level Level) OptionFunc
func WithFormatter ¶
func WithFormatter(formatter Formatter) OptionFunc
func WithHook ¶
func WithHook(level Level, hook Hook) OptionFunc
func WithLogLevelColor ¶
func WithLogLevelColor(level Level, font Attribute) OptionFunc
func WithOutput ¶
func WithOutput(op io.Writer) OptionFunc
func WithStdDisPlayLevel ¶
func WithStdDisPlayLevel(level Level) OptionFunc
type SimpleHook ¶
type SimpleHook struct {
// contains filtered or unexported fields
}
type TextFormatter ¶
type TextFormatter struct {
// contains filtered or unexported fields
}
func (*TextFormatter) Format ¶
func (t *TextFormatter) Format(entry *Entry) error
Click to show internal directories.
Click to hide internal directories.