Documentation ¶
Index ¶
- Constants
- Variables
- func AddHook(fn func(msg Message))
- func Debug(v ...interface{})
- func Error(v ...interface{})
- func Fatal(v ...interface{})
- func Info(v ...interface{})
- func Panic(v ...interface{})
- func SetAdapter(adapter Adapter)
- func SetFileAdapterOptions(opts ...Option)
- func SetTrimPath(trimPaths ...string)
- func Warn(v ...interface{})
- type Adapter
- type ConsoleAdapter
- type Entry
- func (entry *Entry) Debug(v ...interface{})
- func (entry *Entry) Error(v ...interface{})
- func (entry *Entry) Fatal(v ...interface{})
- func (entry *Entry) Info(v ...interface{})
- func (entry *Entry) Panic(v ...interface{})
- func (entry *Entry) Warn(v ...interface{})
- func (entry *Entry) WithField(field string, value interface{}) *Entry
- func (entry *Entry) WithTag(tags ...string) *Entry
- type FileAdapter
- type Level
- type Logger
- func (l *Logger) AddHook(fn func(msg Message))
- func (l *Logger) Debug(v ...interface{})
- func (l *Logger) Error(v ...interface{})
- func (l *Logger) Fatal(v ...interface{})
- func (l *Logger) Info(v ...interface{})
- func (l *Logger) Panic(v ...interface{})
- func (l *Logger) SetAdapter(adapter Adapter)
- func (l *Logger) SetFileAdapterOptions(opts ...Option)
- func (l *Logger) SetTrimPath(trimPaths ...string)
- func (l *Logger) Warn(v ...interface{})
- func (l *Logger) WithField(field string, value interface{}) *Entry
- func (l *Logger) WithTag(tags ...string) *Entry
- type Message
- type Option
Constants ¶
View Source
const ( FileTag = "tag" FileDirname = "dirname" FileMaxSize = "max-size" )
Variables ¶
Functions ¶
func SetAdapter ¶
func SetAdapter(adapter Adapter)
func SetFileAdapterOptions ¶
func SetFileAdapterOptions(opts ...Option)
func SetTrimPath ¶
func SetTrimPath(trimPaths ...string)
Types ¶
type ConsoleAdapter ¶
type ConsoleAdapter struct { }
控制台日志适配器
func NewConsoleAdapter ¶
func NewConsoleAdapter() *ConsoleAdapter
func (ConsoleAdapter) Write ¶
func (ca ConsoleAdapter) Write(msg *Message)
type FileAdapter ¶
type FileAdapter struct {
// contains filtered or unexported fields
}
文件日志适配器
func NewFileAdapter ¶
func NewFileAdapter(opts ...Option) *FileAdapter
func (*FileAdapter) SetOptions ¶
func (fa *FileAdapter) SetOptions(opts ...Option)
func (*FileAdapter) Write ¶
func (fa *FileAdapter) Write(msg *Message)
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) SetAdapter ¶
func (*Logger) SetFileAdapterOptions ¶
func (*Logger) SetTrimPath ¶
type Message ¶
type Option ¶
type Option struct { Name string Value interface{} }
func FileDirnameOption ¶
func FileMaxSizeOption ¶
func FileTagOption ¶
Click to show internal directories.
Click to hide internal directories.