swap atomically replaces the inner WriteSyncer and resets the cap counters. Called by DebugFileSink.Swap after the upstream buffer has been flushed; bytes written before swap are guaranteed to land in the OLD inner because this method holds the write mutex.
(inner zapcore.WriteSyncer)
| 404 | // been flushed; bytes written before swap are guaranteed to land in |
| 405 | // the OLD inner because this method holds the write mutex. |
| 406 | func (s *cappedWriteSyncer) swap(inner zapcore.WriteSyncer) { |
| 407 | s.mu.Lock() |
| 408 | defer s.mu.Unlock() |
| 409 | s.inner = inner |
| 410 | s.written.Store(0) |
| 411 | s.capped.Store(false) |
| 412 | } |
| 413 | |
| 414 | // DebugFileSink is the caller-side handle for the debug-level file sink |
| 415 | // attached by AddDebugFileSink. It owns the buffered + capped writer |
no test coverage detected