Documentation
¶
Index ¶
- func ApplySectionAndProfile(v *viper.Viper, section, profile string) (*viper.Viper, error)
- func GetLogCounters() map[string]int64
- func LoadWithIncludes(base string, includes []string) (*viper.Viper, error)
- func MergeLogSection(v *viper.Viper)
- func SetupLoggerWithFile(level, format, filePath string, maxSizeMB, maxBackups, maxAgeDays int, ...)
- func ValidateAddr(addr string) error
- func ValidateAgentConfig(v *viper.Viper, strict bool) error
- func ValidateServerConfig(v *viper.Viper, strict bool) error
- func ValidateTLS(cert, key, ca string, strict bool) error
- type LogConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplySectionAndProfile ¶
ApplySectionAndProfile extracts a section (server/agent/edge) and overlays profiles.<name> if present.
func GetLogCounters ¶
GetLogCounters returns current log counters by level.
func LoadWithIncludes ¶
LoadWithIncludes reads base config and merges includes in order.
func MergeLogSection ¶
MergeLogSection flattens a nested "log" section into top-level log.* keys.
func SetupLoggerWithFile ¶
func SetupLoggerWithFile(level, format, filePath string, maxSizeMB, maxBackups, maxAgeDays int, compress bool)
SetupLoggerWithFile configures both std log and slog default logger. format: console|json; level: debug|info|warn|error. If filePath != "", logs write to a rotating file.
func ValidateAddr ¶
func ValidateTLS ¶
Types ¶
type LogConfig ¶ added in v0.1.4
type LogConfig struct {
Level string `json:",omitempty" yaml:",omitempty"` // debug|info|warn|error
Format string `json:",omitempty" yaml:",omitempty"` // console|json
Output string `json:",omitempty" yaml:",omitempty"` // stdout|stderr
File string `json:",omitempty" yaml:",omitempty"` // 日志文件路径
MaxSize int `json:",omitempty" yaml:",omitempty"` // 单个日志文件最大大小(MB)
MaxBackups int `json:",omitempty" yaml:",omitempty"` // 保留的旧日志文件最大数量
MaxAge int `json:",omitempty" yaml:",omitempty"` // 保留旧日志文件的最大天数
Compress bool `json:",omitempty" yaml:",omitempty"` // 是否压缩旧日志文件
}
LogConfig 日志配置(通用结构,供所有服务使用)
Click to show internal directories.
Click to hide internal directories.