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