mirror of
https://github.com/go-gitea/gitea.git
synced 2025-11-01 14:35:31 +00:00
use level config in main section when subsection not set level (#15176)
in previouse if a log subsetcion not set level
it will use ``info`` as default value.
this pr will make default value (``[log] -> LEVEL``) useable.
example config:
```INI
[log]
MODE = console
LEVEL = Trace
[log.console]
LEVEL =
STDERR = false
```
previous result:
```JSON
// console:
{
"level": "info",
...................
}
```
after change:
```JSON
// console:
{
"level": "track",
...................
}
```
Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
@@ -304,7 +304,7 @@ var (
|
||||
}
|
||||
|
||||
// Log settings
|
||||
LogLevel string
|
||||
LogLevel log.Level
|
||||
StacktraceLogLevel string
|
||||
LogRootPath string
|
||||
DisableRouterLog bool
|
||||
@@ -553,7 +553,7 @@ func NewContext() {
|
||||
}
|
||||
homeDir = strings.ReplaceAll(homeDir, "\\", "/")
|
||||
|
||||
LogLevel = getLogLevel(Cfg.Section("log"), "LEVEL", "Info")
|
||||
LogLevel = getLogLevel(Cfg.Section("log"), "LEVEL", log.INFO)
|
||||
StacktraceLogLevel = getStacktraceLogLevel(Cfg.Section("log"), "STACKTRACE_LEVEL", "None")
|
||||
LogRootPath = Cfg.Section("log").Key("ROOT_PATH").MustString(path.Join(AppWorkPath, "log"))
|
||||
forcePathSeparator(LogRootPath)
|
||||
|
||||
Reference in New Issue
Block a user