Documentation
¶
Index ¶
- Constants
- func Alert(f interface{}, v ...interface{})
- func Debug(f interface{}, v ...interface{})
- func Error(f interface{}, v ...interface{})
- func Fatal(f interface{}, v ...interface{})
- func Info(f interface{}, v ...interface{})
- func Trace(f interface{}, v ...interface{})
- func Warn(f interface{}, v ...interface{})
- type Adapter
- type ConsoleAdapter
- type FileAdapter
- type Interface
- type Logger
- func (this *Logger) Adapter(i Adapter) error
- func (this *Logger) Alert(format interface{}, args ...interface{})
- func (this *Logger) Close()
- func (this *Logger) Debug(format interface{}, v ...interface{})
- func (this *Logger) Error(format interface{}, v ...interface{})
- func (this *Logger) Fatal(format interface{}, args ...interface{})
- func (this *Logger) Info(format interface{}, v ...interface{})
- func (this *Logger) Remove(i Adapter)
- func (this *Logger) SetCallDepth(depth int)
- func (this *Logger) SetLogPathTrim(trimPath string)
- func (this *Logger) Trace(format interface{}, v ...interface{})
- func (this *Logger) Warn(format interface{}, v ...interface{})
- type Message
- type NetAdapter
Constants ¶
View Source
const ( LevelTrace = iota // 用户级基本输出 LevelDebug // 用户级调试 LevelInfo // 用户级信息 LevelWarn // 用户级警告 LevelError // 用户级错误 LevelAlert //系统级警告,比如数据库访问异常,配置文件出错等 LevelFATAL //PANIC )
日志等级,从0-7,日优先级由高到低
View Source
const DefTimeFormat = "2006-01-02 15:04:05 -0700" // 日志输出默认格式
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsoleAdapter ¶
func NewConsoleAdapter ¶
func NewConsoleAdapter() *ConsoleAdapter
func (*ConsoleAdapter) Close ¶
func (c *ConsoleAdapter) Close()
func (*ConsoleAdapter) Init ¶
func (c *ConsoleAdapter) Init() (err error)
type FileAdapter ¶
type FileAdapter struct {
sync.RWMutex
Level int `json:"level"`
Append bool `json:"append"`
MaxLines int `json:"maxlines"`
MaxSize int `json:"maxsize"`
Daily bool `json:"daily"`
MaxDays int64 `json:"maxdays"`
PermitMask string `json:"permit"`
Filename string `json:"filename"`
Format func(*Message) string `json:"_"`
// contains filtered or unexported fields
}
func NewFileAdapter ¶
func NewFileAdapter(filename string) *FileAdapter
func (*FileAdapter) Close ¶
func (f *FileAdapter) Close()
func (*FileAdapter) Init ¶
func (f *FileAdapter) Init() error
type Interface ¶
type Interface interface {
Fatal(format interface{}, args ...interface{})
Alert(format interface{}, args ...interface{})
Error(format interface{}, args ...interface{})
Warn(format interface{}, args ...interface{})
Info(format interface{}, args ...interface{})
Debug(format interface{}, args ...interface{})
Trace(format interface{}, args ...interface{})
}
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
var DefaultLogger *Logger
func (*Logger) Debug ¶
func (this *Logger) Debug(format interface{}, v ...interface{})
Debug Log DEBUG level message.
func (*Logger) Error ¶
func (this *Logger) Error(format interface{}, v ...interface{})
Error Log ERROR level message.
func (*Logger) Info ¶
func (this *Logger) Info(format interface{}, v ...interface{})
Info Log INFO level message.
func (*Logger) SetCallDepth ¶
func (*Logger) SetLogPathTrim ¶
SetLogPathTrim 设置日志起始路径
type NetAdapter ¶
type NetAdapter struct {
sync.Mutex
Level int `json:"level"`
Network string `json:"network"`
Address string `json:"address"`
Reconnect bool `json:"reconnect"`
Format func(*Message) string
// contains filtered or unexported fields
}
func NewNetAdapter ¶
func NewNetAdapter(network, address string) *NetAdapter
func (*NetAdapter) Close ¶
func (c *NetAdapter) Close()
func (*NetAdapter) Init ¶
func (c *NetAdapter) Init() error
Click to show internal directories.
Click to hide internal directories.