feat: update dockerfile

This commit is contained in:
2025-12-10 23:17:24 +08:00
parent 083142491f
commit 0bc77f61e2
18 changed files with 357 additions and 22 deletions

30
pkg/log/log_config.go Normal file
View File

@@ -0,0 +1,30 @@
package log
var (
maxSize = 100 // MB
outputPath = "/app/logs/app.log"
)
type LogConfig struct {
AppName string `yaml:"appName"` // 应用名称
Level string `yaml:"level"` // debug, info, warn, error
Format string `yaml:"format"` // json, console
OutputPath string `yaml:"outputPath"` // 日志文件路径
MaxSize int `yaml:"maxSize"` // 单个日志文件最大尺寸单位MB
MaxAge int `yaml:"maxAge"` // 日志保留天数
MaxBackups int `yaml:"maxBackups"` // 保留的旧日志文件最大数量
Compress bool `yaml:"compress"` // 是否压缩旧日志
}
func DefaultLogConfig() *LogConfig {
return &LogConfig{
Level: "info",
Format: "json",
OutputPath: outputPath,
MaxSize: maxSize,
MaxAge: 7,
MaxBackups: 3,
Compress: true,
}
}