1
1
mirror of https://github.com/go-gitea/gitea synced 2025-11-13 01:38:12 +00:00

Fix cli "Before" handling (#35797)

Regression of #34973

Fix #35796
This commit is contained in:
wxiaoguang
2025-11-01 02:12:03 +08:00
committed by GitHub
parent ef90befef1
commit de70cd3853
5 changed files with 55 additions and 16 deletions

View File

@@ -121,6 +121,12 @@ func globalBool(c *cli.Command, name string) bool {
// Any log appears in git stdout pipe will break the git protocol, eg: client can't push and hangs forever.
func PrepareConsoleLoggerLevel(defaultLevel log.Level) func(context.Context, *cli.Command) (context.Context, error) {
return func(ctx context.Context, c *cli.Command) (context.Context, error) {
if setting.InstallLock {
// During config loading, there might also be logs (for example: deprecation warnings).
// It must make sure that console logger is set up before config is loaded.
log.Error("Config is loaded before console logger is setup, it will cause bugs. Please fix it.")
return nil, errors.New("console logger must be setup before config is loaded")
}
level := defaultLevel
if globalBool(c, "quiet") {
level = log.FATAL