Documentation
¶
Index ¶
- Constants
- Variables
- type BaseHandlerConfig
- type Config
- type EngineType
- type FileHandlerConfig
- type FilterConfig
- type FormatterConfig
- type FormatterType
- type HandlerConfig
- type HandlerType
- type JSONFormatterConfig
- type OptionFunc
- func SetCacheSize2Logger(size int) OptionFunc
- func SetCacheSize2Report(size int) OptionFunc
- func SetEnableReport() OptionFunc
- func SetFileBackupCount2Logger(count int) OptionFunc
- func SetFileBackupCount2Report(count int) OptionFunc
- func SetFileDir2Logger(path string) OptionFunc
- func SetFileDir2Report(path string) OptionFunc
- func SetFileMaxSize2Logger(size int64) OptionFunc
- func SetFileMaxSize2Report(size int64) OptionFunc
- func SetFileName2Logger(name string) OptionFunc
- func SetFileName2Report(name string) OptionFunc
- func SetFileRematch2Logger(pattern string) OptionFunc
- func SetFileRematch2Report(pattern string) OptionFunc
- func SetFileRotatorType2Logger(typ RotatorType) OptionFunc
- func SetFileRotatorType2Report(typ RotatorType) OptionFunc
- func SetFileTimeFmtSuffix2Logger(timeFmt string) OptionFunc
- func SetFileTimeFmtSuffix2Report(timeFmt string) OptionFunc
- func SetFileWhen2Logger(when RotatorWhenType) OptionFunc
- func SetFileWhen2Report(when RotatorWhenType) OptionFunc
- func SetHandlerType2Logger(typ HandlerType) OptionFunc
- func SetHandlerType2Report(typ HandlerType) OptionFunc
- func SetLevel2Logger(lvl level.LogLevel) OptionFunc
- func SetLevel2Report(lvl level.LogLevel) OptionFunc
- func SetLoggerName(name string) OptionFunc
- type RotatorType
- type RotatorWhenType
- type StreamHandlerConfig
- type SyslogHandlerConfig
- type TextFormatterConfig
- type XMLFormatterConfig
Constants ¶
View Source
const ( FileRotatorSuffixFmt1 = "20060102150405" FileRotatorSuffixFmt2 = "2006-01-02T15-04-05" FileRotatorSuffixFmt3 = "2006-01-02_15-04-05" )
View Source
const ( FileRotatorReMatch1 = "^\\d{14}(\\.\\w+)?$" FileRotatorReMatch2 = "^\\d{4}-\\d{2}-\\d{2}T\\d{2}-\\d{2}-\\d{2}(\\.\\w+)?$" FileRotatorReMatch3 = "^\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}(\\.\\w+)?$" )
View Source
const ( PatternTemplate1 = "%[LoggerName]s (%[Pid]d,%[RoutineId]d) %[DateTime]s.%[Msecs]d %[LevelName]s %[Caller]s %[Message]v" PatternTemplate2 = "<%[TradeId]s> %[LoggerName]s (%[Pid]d,%[RoutineId]d) %[DateTime]s %[LevelName]s %[Caller]s %[Message]v" )
View Source
const (
DefaultTimestampFormat = time.RFC3339
)
Variables ¶
View Source
var GlobalConfig = NewDefaultConfig()
Functions ¶
This section is empty.
Types ¶
type BaseHandlerConfig ¶
type BaseHandlerConfig struct {
HandlerType HandlerType
File FileHandlerConfig
Stream StreamHandlerConfig
Syslog SyslogHandlerConfig
Formatter FormatterConfig
Filter FilterConfig
}
type Config ¶
type Config struct {
ExitOnFatal bool
IsRecordCaller bool
EnableReport bool
LoggerLevel level.LogLevel
ReportLevel level.LogLevel
ReportCacheSize int
LoggerCacheSize int
EngineType EngineType
LoggerName string
Handler HandlerConfig `json:"handler"`
ExitFunc func(code int) // Function to exit the application, defaults to `os.Exit()`
TradeIDFunc func(entry *message.Entry) string
OnError func(msg *message.Entry, err error)
}
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
type EngineType ¶
type EngineType int
const ( EngineTypeChannel EngineType = 1 EngineTypeRingBuffer EngineType = 2 )
type FileHandlerConfig ¶
type FileHandlerConfig struct {
RotatorType RotatorType
FileDir string
FileName string
MaxFileSize int64
BackupCount int
When RotatorWhenType // used in TimeRotator and TimeAndSizeRotator
IntervalStep int64
TimeSuffixFmt string
ReMatch string
FileSuffix string
MultiProcessWrite bool
ErrCallback func(err error)
}
type FilterConfig ¶
type FilterConfig struct {
}
type FormatterConfig ¶
type FormatterConfig struct {
TimestampFormat string
FormatterType FormatterType
Text TextFormatterConfig
Json JSONFormatterConfig
Xml XMLFormatterConfig
}
type FormatterType ¶
type FormatterType int
const ( FormatterTypeText FormatterType = 1 FormatterTypeJson FormatterType = 2 FormatterTypeXml FormatterType = 3 )
type HandlerConfig ¶
type HandlerConfig struct {
LogHandlerConfig BaseHandlerConfig
ReportHandlerConfig BaseHandlerConfig
}
type HandlerType ¶
type HandlerType int
const ( HandlerTypeDefault HandlerType = 0 HandlerTypeFile HandlerType = 1 HandlerTypeStream HandlerType = 2 HandlerTypeSyslog HandlerType = 3 )
type JSONFormatterConfig ¶
type JSONFormatterConfig struct {
}
type OptionFunc ¶
type OptionFunc func(config *Config)
func SetCacheSize2Logger ¶
func SetCacheSize2Logger(size int) OptionFunc
func SetCacheSize2Report ¶
func SetCacheSize2Report(size int) OptionFunc
func SetEnableReport ¶
func SetEnableReport() OptionFunc
func SetFileBackupCount2Logger ¶
func SetFileBackupCount2Logger(count int) OptionFunc
func SetFileBackupCount2Report ¶
func SetFileBackupCount2Report(count int) OptionFunc
func SetFileDir2Logger ¶
func SetFileDir2Logger(path string) OptionFunc
func SetFileDir2Report ¶
func SetFileDir2Report(path string) OptionFunc
func SetFileMaxSize2Logger ¶
func SetFileMaxSize2Logger(size int64) OptionFunc
func SetFileMaxSize2Report ¶
func SetFileMaxSize2Report(size int64) OptionFunc
func SetFileName2Logger ¶
func SetFileName2Logger(name string) OptionFunc
SetFileName2Logger By default, the file name is the same as the logger name, if you need to specify special can be set through this config.
func SetFileName2Report ¶
func SetFileName2Report(name string) OptionFunc
SetFileName2Report By default, the file name is the same as the logger name, if you need to specify special can be set through this config.
func SetFileRematch2Logger ¶
func SetFileRematch2Logger(pattern string) OptionFunc
func SetFileRematch2Report ¶
func SetFileRematch2Report(pattern string) OptionFunc
func SetFileRotatorType2Logger ¶
func SetFileRotatorType2Logger(typ RotatorType) OptionFunc
func SetFileRotatorType2Report ¶
func SetFileRotatorType2Report(typ RotatorType) OptionFunc
func SetFileTimeFmtSuffix2Logger ¶
func SetFileTimeFmtSuffix2Logger(timeFmt string) OptionFunc
func SetFileTimeFmtSuffix2Report ¶
func SetFileTimeFmtSuffix2Report(timeFmt string) OptionFunc
func SetFileWhen2Logger ¶
func SetFileWhen2Logger(when RotatorWhenType) OptionFunc
func SetFileWhen2Report ¶
func SetFileWhen2Report(when RotatorWhenType) OptionFunc
func SetHandlerType2Logger ¶
func SetHandlerType2Logger(typ HandlerType) OptionFunc
func SetHandlerType2Report ¶
func SetHandlerType2Report(typ HandlerType) OptionFunc
func SetLevel2Logger ¶
func SetLevel2Logger(lvl level.LogLevel) OptionFunc
func SetLevel2Report ¶
func SetLevel2Report(lvl level.LogLevel) OptionFunc
func SetLoggerName ¶
func SetLoggerName(name string) OptionFunc
type RotatorType ¶
type RotatorType int
const ( FileRotatorTypeTime RotatorType = 1 FileRotatorTypeSize RotatorType = 2 FileRotatorTypeTimeAndSize RotatorType = 3 )
type RotatorWhenType ¶
type RotatorWhenType int
const ( FileRotatorWhenSecond RotatorWhenType = 1 FileRotatorWhenMinute RotatorWhenType = 2 FileRotatorWhenHour RotatorWhenType = 3 FileRotatorWhenDay RotatorWhenType = 4 )
type StreamHandlerConfig ¶
type StreamHandlerConfig struct {
}
type SyslogHandlerConfig ¶
type TextFormatterConfig ¶
type XMLFormatterConfig ¶
type XMLFormatterConfig struct {
}
Click to show internal directories.
Click to hide internal directories.