config

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PatternTemplateWithDefault = "%[LoggerName]s (%[Pid]d,%[RoutineId]d) %[DateTime]s.%[Msecs]d %[LevelName]s %[Caller]s %[Message]v"
	PatternTemplateWithSimple  = "%[LevelName]s %[DateTime]s.%[Msecs]d %[Caller]s %[Message]v"
	PatternTemplateWithTrace   = "<%[TradeId]s> %[LoggerName]s (%[Pid]d,%[RoutineId]d) %[DateTime]s %[LevelName]s %[Caller]s %[Message]v"
)
View Source
const (
	DefaultTimestampFormat = time.RFC3339
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	LoggerName          string
	LogHandlerConfig    handler.HandlerConfig
	ReportHandlerConfig handler.HandlerConfig
	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)
	ReportCacheSize     int
	LoggerCacheSize     int
	LoggerLevel         level.LogLevel
	ReportLevel         level.LogLevel
	ExitOnFatal         bool
	ThrowOnPanic        bool
	IsRecordCaller      bool
	EnableReport        bool
}

func NewDefaultConfig

func NewDefaultConfig() *Config

type OptionFunc

type OptionFunc func(config *Config)

func EnableExitOnFatal added in v0.2.3

func EnableExitOnFatal() OptionFunc

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 SetFileHandlerConfig2Logger added in v0.2.0

func SetFileHandlerConfig2Logger(fileCfg handler.FileHandlerConfig) OptionFunc

func SetFileHandlerConfig2Report added in v0.2.0

func SetFileHandlerConfig2Report(fileCfg handler.FileHandlerConfig) 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 handler.RotatorType) OptionFunc

func SetFileRotatorType2Report

func SetFileRotatorType2Report(typ handler.RotatorType) OptionFunc

func SetFileTimeFmtSuffix2Logger

func SetFileTimeFmtSuffix2Logger(timeFmt string) OptionFunc

func SetFileTimeFmtSuffix2Report

func SetFileTimeFmtSuffix2Report(timeFmt string) OptionFunc

func SetFileWhen2Logger

func SetFileWhen2Logger(when handler.RotatorWhenType) OptionFunc

func SetFileWhen2Report

func SetFileWhen2Report(when handler.RotatorWhenType) OptionFunc

func SetFormatterConfig2Logger added in v0.2.0

func SetFormatterConfig2Logger(formatterCfg formatter.FormatterConfig) OptionFunc

func SetFormatterConfig2Report added in v0.2.0

func SetFormatterConfig2Report(formatterCfg formatter.FormatterConfig) OptionFunc

func SetFormatterType2Logger added in v0.2.0

func SetFormatterType2Logger(typ formatter.FormatterType) OptionFunc

func SetFormatterType2Report added in v0.2.0

func SetFormatterType2Report(typ formatter.FormatterType) OptionFunc

func SetHandlerType2Logger

func SetHandlerType2Logger(typ handler.HandlerType) OptionFunc

func SetHandlerType2Report

func SetHandlerType2Report(typ handler.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

SetLoggerName Set the name of the logger, the default is the name of the program.

func SetStreamer2Logger added in v0.2.0

func SetStreamer2Logger(streamer handler.IStreamer) OptionFunc

func SetStreamer2Report added in v0.2.0

func SetStreamer2Report(streamer handler.IStreamer) OptionFunc

func SetSyslogHandlerConfig2Logger added in v0.2.0

func SetSyslogHandlerConfig2Logger(syslogCfg handler.SyslogHandlerConfig) OptionFunc

func SetSyslogHandlerConfig2Report added in v0.2.0

func SetSyslogHandlerConfig2Report(syslogCfg handler.SyslogHandlerConfig) OptionFunc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL