Documentation
¶
Index ¶
- Constants
- func Debug(msg string, args ...interface{})
- func DebugByName(name, msg string, args ...interface{})
- func Error(msg string, args ...interface{})
- func ErrorByName(name, msg string, args ...interface{})
- func Info(msg string, args ...interface{})
- func InfoByName(name, msg string, args ...interface{})
- func Warn(msg string, args ...interface{})
- func WarnByName(name, msg string, args ...interface{})
- type LogConfig
- type LogMessage
- type Logger
Constants ¶
View Source
const ( LevelDebug = iota LevelInfo LevelWarn LevelError )
View Source
const ( DefaultKeyDebug = "debug" DefaultKeyInfo = "info" DefaultKeyWarn = "warn" DefaultKeyError = "error" )
View Source
const DefaultChannelCache = 10
View Source
const DefaultMapKey = "default"
View Source
const DefaultPath = "./logs"
View Source
const (
MillTimeFormat = "2006-01-02 15:04:05.000"
)
Variables ¶
This section is empty.
Functions ¶
func DebugByName ¶
func DebugByName(name, msg string, args ...interface{})
func ErrorByName ¶
func ErrorByName(name, msg string, args ...interface{})
func InfoByName ¶
func InfoByName(name, msg string, args ...interface{})
func WarnByName ¶
func WarnByName(name, msg string, args ...interface{})
Types ¶
type LogConfig ¶
type LogConfig struct {
Path string `json:"path"`
Name string `json:"name"`
Level int `json:"level"`
Override bool `json:"override"`
ToConsole bool `json:"toConsole"`
Split2Day bool `json:"split2Day"` // 是否需要拆分成按日期分的不同文件
SimpleFile bool `json:"simpleFile"` // true 所有日志都写入单个文件, false 日志按等级拆分成多个文件
ShowStack bool `json:"showStack"` // 当错误时是否显示stack
}
func NewLogConfig ¶
func NewLogConfig() *LogConfig
func NewLoggerConfByPath ¶
type LogMessage ¶
type Logger ¶
type Logger struct {
Key string // the key of map
Ctx context.Context // the context of log
CancelFunc context.CancelFunc // the func of cancel logger
Channel chan LogMessage // the input chan
Conf *LogConfig
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.