uniugm/admin/lib/node/node_log.go
2025-04-18 17:17:23 +08:00

38 lines
918 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @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 (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
}