mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-25 10:18:59 +02:00
feat(config): add temporary logging for failed reloads
- Add tmpLogBuf and tmpLog fields to capture config loading logs - Flush temporary logs only when reload succeeds - Extract NewLogger function for creating custom loggers - Update State interface to include FlushTmpLog method
This commit is contained in:
@@ -45,6 +45,9 @@ func Load() error {
|
||||
notifyError("init", err)
|
||||
}
|
||||
SetState(state)
|
||||
|
||||
// flush temporary log
|
||||
state.FlushTmpLog()
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -69,6 +72,9 @@ func Reload() gperr.Error {
|
||||
return gperr.New(ansi.Warning("using last config")).With(err)
|
||||
}
|
||||
|
||||
// flush temporary log
|
||||
newState.FlushTmpLog()
|
||||
|
||||
// cancel all current subtasks -> wait
|
||||
// -> replace config -> start new subtasks
|
||||
GetState().Task().FinishAndWait(config.ErrConfigChanged)
|
||||
|
||||
Reference in New Issue
Block a user