/** * @Author: likun * @Title: todo * @Description: todo * @File: node_log * @Date: 2024-11-08 14:39:33 */ package node type LogBootConfig struct { EnableStdout bool `yaml:"enable_stdout"` EnableFile bool `yaml:"enable_file"` LogDir string `yaml:"log_dir"` LogFileSize int `yaml:"log_file_size"` // 单个日志文件最大容量(单位:G) LogFileRotateCount int `yaml:"log_file_rotate_count"` // 日志文件最大滚动次数 LogLevel string `yaml:"log_level"` // 日志等级: trace/debug/info/notice/warn/error/fatal } func DefaultLogBootConfig() *LogBootConfig { return &LogBootConfig{ LogLevel: "trace", } } func (lc *LogBootConfig) Check() *LogBootConfig { if lc.LogDir == "" { lc.LogDir = "./logs" } if lc.LogFileSize == 0 { lc.LogFileSize = 1024 * 1024 * 1024 * 5 } if lc.LogFileRotateCount == 0 { lc.LogFileRotateCount = 10 } if lc.LogLevel == "" { lc.LogLevel = "debug" } return lc }