mirror of
https://github.com/caddyserver/caddy.git
synced 2025-11-11 17:04:28 +08:00
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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user