Documentation ¶
Overview ¶
Package ztest provides low-level helpers for testing log output. These utilities are helpful in zap's own unit tests, but any assertions using them are strongly coupled to a single encoding.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Initialize ¶
func Initialize(factor string) func()
Initialize checks the environment and alters the timeout scale accordingly. It returns a function to undo the scaling.
Types ¶
type Buffer ¶
Buffer is an implementation of zapcore.WriteSyncer that sends all writes to a bytes.Buffer. It has convenience methods to split the accumulated buffer on newlines.
type FailWriter ¶
type FailWriter struct{ Syncer }
FailWriter is a WriteSyncer that always returns an error on writes.
type MockClock ¶ added in v1.20.0
type MockClock struct {
// contains filtered or unexported fields
}
MockClock provides control over the time.
func NewMockClock ¶ added in v1.20.0
func NewMockClock() *MockClock
NewMockClock builds a new mock clock that provides control of time.
type ShortWriter ¶
type ShortWriter struct{ Syncer }
ShortWriter is a WriteSyncer whose write method never fails, but nevertheless fails to the last byte of the input.
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
A Syncer is a spy for the Sync portion of zapcore.WriteSyncer.