mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Stop colorizing files by default (#6949)
This commit is contained in:
		@@ -334,7 +334,7 @@ NB: You must `REDIRECT_MACARON_LOG` and have `DISABLE_ROUTER_LOG` set to `false`
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### Console log mode (`log.console`, `log.console.*`, or `MODE=console`)
 | 
					### Console log mode (`log.console`, `log.console.*`, or `MODE=console`)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- For the console logger `COLORIZE` will default to `true` if not on windows.
 | 
					- For the console logger `COLORIZE` will default to `true` if not on windows or the terminal is determined to be able to color.
 | 
				
			||||||
- `STDERR`: **false**: Use Stderr instead of Stdout.
 | 
					- `STDERR`: **false**: Use Stderr instead of Stdout.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### File log mode (`log.file`, `log.file.*` or `MODE=file`)
 | 
					### File log mode (`log.file`, `log.file.*` or `MODE=file`)
 | 
				
			||||||
@@ -344,7 +344,6 @@ NB: You must `REDIRECT_MACARON_LOG` and have `DISABLE_ROUTER_LOG` set to `false`
 | 
				
			|||||||
- `MAX_SIZE_SHIFT`: **28**: Maximum size shift of a single file, 28 represents 256Mb.
 | 
					- `MAX_SIZE_SHIFT`: **28**: Maximum size shift of a single file, 28 represents 256Mb.
 | 
				
			||||||
- `DAILY_ROTATE`: **true**: Rotate logs daily.
 | 
					- `DAILY_ROTATE`: **true**: Rotate logs daily.
 | 
				
			||||||
- `MAX_DAYS`: **7**: Delete the log file after n days
 | 
					- `MAX_DAYS`: **7**: Delete the log file after n days
 | 
				
			||||||
- NB: `COLORIZE`: will default to `true` if not on windows.
 | 
					 | 
				
			||||||
- `COMPRESS`: **true**: Compress old log files by default with gzip
 | 
					- `COMPRESS`: **true**: Compress old log files by default with gzip
 | 
				
			||||||
- `COMPRESSION_LEVEL`: **-1**: Compression level
 | 
					- `COMPRESSION_LEVEL`: **-1**: Compression level
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -213,7 +213,7 @@ from `[log.sublogger]`.
 | 
				
			|||||||
a stacktrace. This value is inherited.
 | 
					a stacktrace. This value is inherited.
 | 
				
			||||||
* `MODE` is the mode of the log output. It will default to the sublogger
 | 
					* `MODE` is the mode of the log output. It will default to the sublogger
 | 
				
			||||||
name. Thus `[log.console.macaron]` will default to `MODE = console`.
 | 
					name. Thus `[log.console.macaron]` will default to `MODE = console`.
 | 
				
			||||||
* `COLORIZE` will default to `true` for `file` and `console` as
 | 
					* `COLORIZE` will default to `true` for `console` as
 | 
				
			||||||
described, otherwise it will default to `false`.
 | 
					described, otherwise it will default to `false`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Non-inherited default values
 | 
					### Non-inherited default values
 | 
				
			||||||
@@ -274,7 +274,6 @@ Other values:
 | 
				
			|||||||
* `MAX_SIZE_SHIFT`: **28**: Maximum size shift of a single file, 28 represents 256Mb.
 | 
					* `MAX_SIZE_SHIFT`: **28**: Maximum size shift of a single file, 28 represents 256Mb.
 | 
				
			||||||
* `DAILY_ROTATE`: **true**: Rotate logs daily.
 | 
					* `DAILY_ROTATE`: **true**: Rotate logs daily.
 | 
				
			||||||
* `MAX_DAYS`: **7**: Delete the log file after n days
 | 
					* `MAX_DAYS`: **7**: Delete the log file after n days
 | 
				
			||||||
* NB: `COLORIZE`: will default to `true` if not on windows.
 | 
					 | 
				
			||||||
* `COMPRESS`: **true**: Compress old log files by default with gzip
 | 
					* `COMPRESS`: **true**: Compress old log files by default with gzip
 | 
				
			||||||
* `COMPRESSION_LEVEL`: **-1**: Compression level
 | 
					* `COMPRESSION_LEVEL`: **-1**: Compression level
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,6 @@ import (
 | 
				
			|||||||
	"os"
 | 
						"os"
 | 
				
			||||||
	"path"
 | 
						"path"
 | 
				
			||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
	"runtime"
 | 
					 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"code.gitea.io/gitea/modules/log"
 | 
						"code.gitea.io/gitea/modules/log"
 | 
				
			||||||
@@ -113,7 +112,6 @@ func generateLogConfig(sec *ini.Section, name string, defaults defaultLogOptions
 | 
				
			|||||||
			panic(err.Error())
 | 
								panic(err.Error())
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		logConfig["colorize"] = sec.Key("COLORIZE").MustBool(runtime.GOOS != "windows")
 | 
					 | 
				
			||||||
		logConfig["filename"] = logPath
 | 
							logConfig["filename"] = logPath
 | 
				
			||||||
		logConfig["rotate"] = sec.Key("LOG_ROTATE").MustBool(true)
 | 
							logConfig["rotate"] = sec.Key("LOG_ROTATE").MustBool(true)
 | 
				
			||||||
		logConfig["maxsize"] = 1 << uint(sec.Key("MAX_SIZE_SHIFT").MustInt(28))
 | 
							logConfig["maxsize"] = 1 << uint(sec.Key("MAX_SIZE_SHIFT").MustInt(28))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user