logging: Adjustments to BufferedLog to keep logs in the correct order (#7257)

* logging: Adjustments to BufferedLog to keep logs in the correct order

* Ignore lints
This commit is contained in:
Francis Lavoie
2025-09-15 11:29:50 -04:00
committed by GitHub
parent 0ba8786b35
commit 39ace450de
3 changed files with 37 additions and 6 deletions

View File

@@ -192,6 +192,13 @@ func (logging *Logging) setupNewDefault(ctx Context) error {
)
}
// if we had a buffered core, flush its contents ASAP
// before we try to log anything else, so the order of
// logs is preserved
if oldBufferCore, ok := oldDefault.logger.Core().(*internal.LogBufferCore); ok {
oldBufferCore.FlushTo(newDefault.logger)
}
return nil
}