Documentation ¶
Index ¶
- Constants
- func Debug(format string, args ...interface{})
- func Error(format string, args ...interface{})
- func Fatal(format string, args ...interface{})
- func GetLineInfo() (fileName string, funcName string, lineNo int)
- func Info(format string, args ...interface{})
- func InitLogger(name string, config map[string]string) (err error)
- func Trace(format string, args ...interface{})
- func Warn(format string, args ...interface{})
- type ConsoleLogger
- func (c *ConsoleLogger) Close()
- func (c *ConsoleLogger) Debug(format string, args ...interface{})
- func (c *ConsoleLogger) Error(format string, args ...interface{})
- func (c *ConsoleLogger) Fatal(format string, args ...interface{})
- func (c *ConsoleLogger) Info(format string, args ...interface{})
- func (c *ConsoleLogger) Init()
- func (c *ConsoleLogger) SetLevel(level int)
- func (c *ConsoleLogger) Trace(format string, args ...interface{})
- func (c *ConsoleLogger) Warn(format string, args ...interface{})
- type FileLogger
- func (f *FileLogger) Close()
- func (f *FileLogger) Debug(format string, args ...interface{})
- func (f *FileLogger) Error(format string, args ...interface{})
- func (f *FileLogger) Fatal(format string, args ...interface{})
- func (f *FileLogger) Info(format string, args ...interface{})
- func (f *FileLogger) Init()
- func (f *FileLogger) SetLevel(level int)
- func (f *FileLogger) Trace(format string, args ...interface{})
- func (f *FileLogger) Warn(format string, args ...interface{})
- type LogData
- type LogInterface
Constants ¶
View Source
const ( LogLevelDebug = iota LogLevelTrace LogLevelInfo LogLevelWarn LogLevelError LogLevelFatal )
View Source
const ( LogSplitTypeHour = iota LogSplitTypeSize )
Variables ¶
This section is empty.
Functions ¶
func GetLineInfo ¶
func InitLogger ¶
file, "初始化一个文件日志实例" console, "初始化console日志实例"
Types ¶
type ConsoleLogger ¶
type ConsoleLogger struct {
// contains filtered or unexported fields
}
func (*ConsoleLogger) Close ¶
func (c *ConsoleLogger) Close()
func (*ConsoleLogger) Debug ¶
func (c *ConsoleLogger) Debug(format string, args ...interface{})
func (*ConsoleLogger) Error ¶
func (c *ConsoleLogger) Error(format string, args ...interface{})
func (*ConsoleLogger) Fatal ¶
func (c *ConsoleLogger) Fatal(format string, args ...interface{})
func (*ConsoleLogger) Info ¶
func (c *ConsoleLogger) Info(format string, args ...interface{})
func (*ConsoleLogger) Init ¶
func (c *ConsoleLogger) Init()
func (*ConsoleLogger) SetLevel ¶
func (c *ConsoleLogger) SetLevel(level int)
func (*ConsoleLogger) Trace ¶
func (c *ConsoleLogger) Trace(format string, args ...interface{})
func (*ConsoleLogger) Warn ¶
func (c *ConsoleLogger) Warn(format string, args ...interface{})
type FileLogger ¶
type FileLogger struct { LogDataChan chan *LogData // contains filtered or unexported fields }
2018/3/26 0:01.383 DEBUG logDebug.go:29 this is a debug log 2006-01-02 15:04:05.999
func (*FileLogger) Close ¶
func (f *FileLogger) Close()
func (*FileLogger) Debug ¶
func (f *FileLogger) Debug(format string, args ...interface{})
func (*FileLogger) Error ¶
func (f *FileLogger) Error(format string, args ...interface{})
func (*FileLogger) Fatal ¶
func (f *FileLogger) Fatal(format string, args ...interface{})
func (*FileLogger) Info ¶
func (f *FileLogger) Info(format string, args ...interface{})
func (*FileLogger) Init ¶
func (f *FileLogger) Init()
func (*FileLogger) SetLevel ¶
func (f *FileLogger) SetLevel(level int)
func (*FileLogger) Trace ¶
func (f *FileLogger) Trace(format string, args ...interface{})
func (*FileLogger) Warn ¶
func (f *FileLogger) Warn(format string, args ...interface{})
type LogInterface ¶
type LogInterface interface { Init() SetLevel(level int) Debug(format string, args ...interface{}) Trace(format string, args ...interface{}) Info(format string, args ...interface{}) Warn(format string, args ...interface{}) Error(format string, args ...interface{}) Fatal(format string, args ...interface{}) Close() }
公用接口,所调用对象皆可使用实例
func NewConsoleLogger ¶
func NewConsoleLogger(config map[string]string) (log LogInterface, err error)
func NewFileLogger ¶
func NewFileLogger(config map[string]string) (log LogInterface, err error)
Click to show internal directories.
Click to hide internal directories.