Documentation ¶
Overview ¶
Package logx Create on 2023/6/30 @author xuzhuoxi
Index ¶
- Variables
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Debugln(v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Errorln(v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Fatalln(v ...interface{})
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Infoln(v ...interface{})
- func Print(v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- func RemoveConfig(t LogType)
- func SetColorFormat(enable bool)
- func SetConfig(cfg LogConfig)
- func SetFlags(flag int, t ...LogType)
- func SetLevel(level LogLevel, t ...LogType)
- func SetPrefix(prefix string)
- func Trace(v ...interface{})
- func Tracef(format string, v ...interface{})
- func Traceln(v ...interface{})
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- func Warnln(v ...interface{})
- type CfgLog
- type ILogger
- type ILoggerActions
- type ILoggerGetter
- type ILoggerManager
- type ILoggerManagerActions
- type ILoggerSetter
- type ILoggerSettings
- type ILoggerSupport
- type LogConfig
- type LogLevel
- type LogType
- type LoggerManager
- func (o *LoggerManager) Clear()
- func (o *LoggerManager) Debug(name string, v ...interface{})
- func (o *LoggerManager) Debugf(name string, format string, v ...interface{})
- func (o *LoggerManager) Debugln(name string, v ...interface{})
- func (o *LoggerManager) Error(name string, v ...interface{})
- func (o *LoggerManager) Errorf(name string, format string, v ...interface{})
- func (o *LoggerManager) Errorln(name string, v ...interface{})
- func (o *LoggerManager) Fatal(name string, v ...interface{})
- func (o *LoggerManager) Fatalf(name string, format string, v ...interface{})
- func (o *LoggerManager) Fatalln(name string, v ...interface{})
- func (o *LoggerManager) FindLogger(name string) ILogger
- func (o *LoggerManager) GenLogger(name string, config CfgLog) error
- func (o *LoggerManager) GetDefaultLogger() ILogger
- func (o *LoggerManager) Info(name string, v ...interface{})
- func (o *LoggerManager) Infof(name string, format string, v ...interface{})
- func (o *LoggerManager) Infoln(name string, v ...interface{})
- func (o *LoggerManager) Log(name string, level LogLevel, v ...interface{})
- func (o *LoggerManager) Logf(name string, level LogLevel, format string, v ...interface{})
- func (o *LoggerManager) Logln(name string, level LogLevel, v ...interface{})
- func (o *LoggerManager) Print(name string, v ...interface{})
- func (o *LoggerManager) Printf(name string, format string, v ...interface{})
- func (o *LoggerManager) Println(name string, v ...interface{})
- func (o *LoggerManager) RegisterLogger(name string, logger ILogger) error
- func (o *LoggerManager) SetDefault(logName string) bool
- func (o *LoggerManager) Trace(name string, v ...interface{})
- func (o *LoggerManager) Tracef(name string, format string, v ...interface{})
- func (o *LoggerManager) Traceln(name string, v ...interface{})
- func (o *LoggerManager) UnregisterLogger(name string) (logger ILogger, err error)
- func (o *LoggerManager) Warn(name string, v ...interface{})
- func (o *LoggerManager) Warnf(name string, format string, v ...interface{})
- func (o *LoggerManager) Warnln(name string, v ...interface{})
- type LoggerSupport
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultLoggerManager = NewLoggerManager() DefaultLoggerName = "global" )
Functions ¶
func RemoveConfig ¶
func RemoveConfig(t LogType)
func SetColorFormat ¶ added in v1.0.4
func SetColorFormat(enable bool)
Types ¶
type CfgLog ¶ added in v1.0.4
type CfgLog struct { LogType LogType `json:"type" yaml:"type"` LogLevel LogLevel `json:"level" yaml:"level"` LogPath string `json:"path" yaml:"path"` LogSize string `json:"size" yaml:"size"` }
func (CfgLog) GetAbsLogPath ¶ added in v1.0.4
func (CfgLog) ToLogConfig ¶ added in v1.0.4
type ILogger ¶
type ILogger interface { ILoggerSettings ILoggerActions }
func DefaultLogger ¶
func DefaultLogger() ILogger
type ILoggerActions ¶ added in v1.0.4
type ILoggerActions interface { // Print 普通记录,忽略前缀 Print(v ...interface{}) // Printf 普通记录,忽略前缀 Printf(format string, v ...interface{}) // Println 普通记录,忽略前缀 Println(v ...interface{}) Log(level LogLevel, v ...interface{}) Logf(level LogLevel, format string, v ...interface{}) Logln(level LogLevel, v ...interface{}) Trace(v ...interface{}) Tracef(format string, v ...interface{}) Traceln(v ...interface{}) Debug(v ...interface{}) Debugf(format string, v ...interface{}) Debugln(v ...interface{}) Info(v ...interface{}) Infof(format string, v ...interface{}) Infoln(v ...interface{}) Warn(v ...interface{}) Warnf(format string, v ...interface{}) Warnln(v ...interface{}) Error(v ...interface{}) Errorf(format string, v ...interface{}) Errorln(v ...interface{}) Fatal(v ...interface{}) Fatalf(format string, v ...interface{}) Fatalln(v ...interface{}) }
type ILoggerGetter ¶
type ILoggerGetter interface {
GetLogger() ILogger
}
type ILoggerManager ¶ added in v1.0.4
type ILoggerManager interface { // GenLogger // 生成Logger并加入注册 GenLogger(name string, config CfgLog) error // RegisterLogger // 注册一个Logger到管理器 RegisterLogger(name string, logger ILogger) error // UnregisterLogger // 取消Logger的注册 UnregisterLogger(name string) (logger ILogger, err error) // FindLogger // 查找Logger FindLogger(name string) ILogger // Clear // 清除全部已注册的Logger信息 Clear() // SetDefault // 设置默认Logger SetDefault(logName string) bool // GetDefaultLogger // 对默认Logger GetDefaultLogger() ILogger ILoggerManagerActions }
func NewLoggerManager ¶ added in v1.0.4
func NewLoggerManager() ILoggerManager
type ILoggerManagerActions ¶ added in v1.0.4
type ILoggerManagerActions interface { // Print 普通记录,忽略前缀 Print(name string, v ...interface{}) // Printf 普通记录,忽略前缀 Printf(name string, format string, v ...interface{}) // Println 普通记录,忽略前缀 Println(name string, v ...interface{}) Log(name string, level LogLevel, v ...interface{}) Logf(name string, level LogLevel, format string, v ...interface{}) Logln(name string, level LogLevel, v ...interface{}) Trace(name string, v ...interface{}) Tracef(name string, format string, v ...interface{}) Traceln(name string, v ...interface{}) Debug(name string, v ...interface{}) Debugf(name string, format string, v ...interface{}) Debugln(name string, v ...interface{}) Info(name string, v ...interface{}) Infof(name string, format string, v ...interface{}) Infoln(name string, v ...interface{}) Warn(name string, v ...interface{}) Warnf(name string, format string, v ...interface{}) Warnln(name string, v ...interface{}) Error(name string, v ...interface{}) Errorf(name string, format string, v ...interface{}) Errorln(name string, v ...interface{}) Fatal(name string, v ...interface{}) Fatalf(name string, format string, v ...interface{}) Fatalln(name string, v ...interface{}) }
type ILoggerSetter ¶
type ILoggerSetter interface {
SetLogger(logger ILogger)
}
type ILoggerSettings ¶ added in v1.0.4
type ILoggerSettings interface { // SetPrefix 设置日志前缀 SetPrefix(prefix string) // SetLevel // 设置日志等级,只有大于等级设置等级的日志才会记录 // 重置日志等级为level,t为空时重置全部 SetLevel(level LogLevel, t ...LogType) // SetFlags sets the output flags for the logger. // 重置日志flag,t为空时重置全部 SetFlags(flag int, t ...LogType) // SetConfig // 配置Log,要求fileDir以"/"结尾 SetConfig(cfg LogConfig) // RemoveConfig 移除配置 RemoveConfig(t LogType) }
type ILoggerSupport ¶
type ILoggerSupport interface { ILoggerSetter ILoggerGetter }
type LogConfig ¶
type LogConfig struct { Type LogType `json:"type" yaml:"type"` Level LogLevel `json:"level" yaml:"level"` Flag int `json:"flag,omitempty" yaml:"flag,omitempty"` FileDir string `json:"dir" yaml:"dir"` FileName string `json:"name" yaml:"name"` FileExtName string `json:"ext" yaml:"ext"` // 要带"." FilePath string `json:"path" yaml:"path"` // 这里有了就会覆盖FileDir,FileName,FileExtName属性 MaxSize mathx.SizeUnit `json:"size,omitempty" yaml:"size,omitempty"` }
func (LogConfig) GetFileInfos ¶ added in v1.0.4
type LoggerManager ¶ added in v1.0.4
type LoggerManager struct {
// contains filtered or unexported fields
}
func (*LoggerManager) Clear ¶ added in v1.0.4
func (o *LoggerManager) Clear()
func (*LoggerManager) Debug ¶ added in v1.0.4
func (o *LoggerManager) Debug(name string, v ...interface{})
func (*LoggerManager) Debugf ¶ added in v1.0.4
func (o *LoggerManager) Debugf(name string, format string, v ...interface{})
func (*LoggerManager) Debugln ¶ added in v1.0.4
func (o *LoggerManager) Debugln(name string, v ...interface{})
func (*LoggerManager) Error ¶ added in v1.0.4
func (o *LoggerManager) Error(name string, v ...interface{})
func (*LoggerManager) Errorf ¶ added in v1.0.4
func (o *LoggerManager) Errorf(name string, format string, v ...interface{})
func (*LoggerManager) Errorln ¶ added in v1.0.4
func (o *LoggerManager) Errorln(name string, v ...interface{})
func (*LoggerManager) Fatal ¶ added in v1.0.4
func (o *LoggerManager) Fatal(name string, v ...interface{})
func (*LoggerManager) Fatalf ¶ added in v1.0.4
func (o *LoggerManager) Fatalf(name string, format string, v ...interface{})
func (*LoggerManager) Fatalln ¶ added in v1.0.4
func (o *LoggerManager) Fatalln(name string, v ...interface{})
func (*LoggerManager) FindLogger ¶ added in v1.0.4
func (o *LoggerManager) FindLogger(name string) ILogger
func (*LoggerManager) GenLogger ¶ added in v1.0.4
func (o *LoggerManager) GenLogger(name string, config CfgLog) error
func (*LoggerManager) GetDefaultLogger ¶ added in v1.0.4
func (o *LoggerManager) GetDefaultLogger() ILogger
func (*LoggerManager) Info ¶ added in v1.0.4
func (o *LoggerManager) Info(name string, v ...interface{})
func (*LoggerManager) Infof ¶ added in v1.0.4
func (o *LoggerManager) Infof(name string, format string, v ...interface{})
func (*LoggerManager) Infoln ¶ added in v1.0.4
func (o *LoggerManager) Infoln(name string, v ...interface{})
func (*LoggerManager) Log ¶ added in v1.0.4
func (o *LoggerManager) Log(name string, level LogLevel, v ...interface{})
func (*LoggerManager) Logf ¶ added in v1.0.4
func (o *LoggerManager) Logf(name string, level LogLevel, format string, v ...interface{})
func (*LoggerManager) Logln ¶ added in v1.0.4
func (o *LoggerManager) Logln(name string, level LogLevel, v ...interface{})
func (*LoggerManager) Print ¶ added in v1.0.4
func (o *LoggerManager) Print(name string, v ...interface{})
func (*LoggerManager) Printf ¶ added in v1.0.4
func (o *LoggerManager) Printf(name string, format string, v ...interface{})
func (*LoggerManager) Println ¶ added in v1.0.4
func (o *LoggerManager) Println(name string, v ...interface{})
func (*LoggerManager) RegisterLogger ¶ added in v1.0.4
func (o *LoggerManager) RegisterLogger(name string, logger ILogger) error
func (*LoggerManager) SetDefault ¶ added in v1.0.4
func (o *LoggerManager) SetDefault(logName string) bool
func (*LoggerManager) Trace ¶ added in v1.0.4
func (o *LoggerManager) Trace(name string, v ...interface{})
func (*LoggerManager) Tracef ¶ added in v1.0.4
func (o *LoggerManager) Tracef(name string, format string, v ...interface{})
func (*LoggerManager) Traceln ¶ added in v1.0.4
func (o *LoggerManager) Traceln(name string, v ...interface{})
func (*LoggerManager) UnregisterLogger ¶ added in v1.0.4
func (o *LoggerManager) UnregisterLogger(name string) (logger ILogger, err error)
func (*LoggerManager) Warn ¶ added in v1.0.4
func (o *LoggerManager) Warn(name string, v ...interface{})
func (*LoggerManager) Warnf ¶ added in v1.0.4
func (o *LoggerManager) Warnf(name string, format string, v ...interface{})
func (*LoggerManager) Warnln ¶ added in v1.0.4
func (o *LoggerManager) Warnln(name string, v ...interface{})
type LoggerSupport ¶
type LoggerSupport struct {
// contains filtered or unexported fields
}
func (*LoggerSupport) GetLogger ¶
func (s *LoggerSupport) GetLogger() ILogger
func (*LoggerSupport) SetLogger ¶
func (s *LoggerSupport) SetLogger(logger ILogger)
Click to show internal directories.
Click to hide internal directories.