You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The WriteSyncer abstraction already supports buffering or asynchronous implementations. However, the logger APIs don't expose a way to flush any buffered messages before shutting down. In a post-1.0 point release, we should add a Close method to loggers and an OnClose option (to register shutdown hooks). The opinionated Config struct can then register hooks to sync all underlying WriteSyncers.
This will have to remain an opt-in setup, since there's no way to guarantee that Close is called on all panics and exits (including those not triggered by logger.Panic and logger.Fatal).
The text was updated successfully, but these errors were encountered:
This is a breaking change that adds a `Sync` method to `zapcore.Core`. The
intention here is to expose `Sync` all the way up to the loggers themselves;
this lets implementations buffer I/O, since the end user can `Sync` at the end
of main.
(Of course, nothing can save users if they directly panic or os.Exit from a
different goroutine.)
This fixes#355.
The
WriteSyncer
abstraction already supports buffering or asynchronous implementations. However, the logger APIs don't expose a way to flush any buffered messages before shutting down. In a post-1.0 point release, we should add aClose
method to loggers and anOnClose
option (to register shutdown hooks). The opinionatedConfig
struct can then register hooks to sync all underlyingWriteSyncer
s.This will have to remain an opt-in setup, since there's no way to guarantee that
Close
is called on all panics and exits (including those not triggered by logger.Panic and logger.Fatal).The text was updated successfully, but these errors were encountered: