mirror of https://github.com/Xhofe/alist
feat: add log enable config
parent
cd21f14106
commit
5b73b68eb5
|
@ -22,7 +22,7 @@ func Log() {
|
||||||
FullTimestamp: true,
|
FullTimestamp: true,
|
||||||
})
|
})
|
||||||
logConfig := conf.Conf.Log
|
logConfig := conf.Conf.Log
|
||||||
if !args.Debug && logConfig.Path != "" {
|
if logConfig.Enable {
|
||||||
var (
|
var (
|
||||||
writer *rotatelogs.RotateLogs
|
writer *rotatelogs.RotateLogs
|
||||||
err error
|
err error
|
||||||
|
|
|
@ -24,6 +24,7 @@ type CacheConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type LogConfig struct {
|
type LogConfig struct {
|
||||||
|
Enable bool `json:"enable" env:"log_enable"`
|
||||||
Path string `json:"path" env:"LOG_PATH"`
|
Path string `json:"path" env:"LOG_PATH"`
|
||||||
Name string `json:"name" env:"LOG_NAME"`
|
Name string `json:"name" env:"LOG_NAME"`
|
||||||
RotationTime uint `json:"rotation_time" env:"LOG_TIME"`
|
RotationTime uint `json:"rotation_time" env:"LOG_TIME"`
|
||||||
|
@ -59,6 +60,7 @@ func DefaultConfig() *Config {
|
||||||
CleanupInterval: 120,
|
CleanupInterval: 120,
|
||||||
},
|
},
|
||||||
Log: LogConfig{
|
Log: LogConfig{
|
||||||
|
Enable: true,
|
||||||
Path: "log/%Y-%m-%d-%H:%M.log",
|
Path: "log/%Y-%m-%d-%H:%M.log",
|
||||||
Name: "log/log.log",
|
Name: "log/log.log",
|
||||||
RotationTime: 24,
|
RotationTime: 24,
|
||||||
|
|
Loading…
Reference in New Issue