Skip to content

Commit 7bceb6c

Browse files
committed
add an extra check
1 parent 4372fab commit 7bceb6c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmd/cmd.go

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

0 commit comments

Comments
 (0)