package
1.27.0
Repository: https://github.com/uber-go/zap.git
Documentation: pkg.go.dev

# Functions

AddSync converts an io.Writer to a WriteSyncer.
CapitalColorLevelEncoder serializes a Level to an all-caps string and adds color.
CapitalLevelEncoder serializes a Level to an all-caps string.
EpochMillisTimeEncoder serializes a time.Time to a floating-point number of milliseconds since the Unix epoch.
EpochNanosTimeEncoder serializes a time.Time to an integer number of nanoseconds since the Unix epoch.
EpochTimeEncoder serializes a time.Time to a floating-point number of seconds since the Unix epoch.
FullCallerEncoder serializes a caller in /full/path/to/package/file:line format.
FullNameEncoder serializes the logger name as-is.
ISO8601TimeEncoder serializes a time.Time to an ISO8601-formatted string with millisecond precision.
LevelOf reports the minimum enabled log level for the given LevelEnabler from Zap's supported log levels, or [InvalidLevel] if none of them are enabled.
Lock wraps a WriteSyncer in a mutex to make it safe for concurrent use.
LowercaseColorLevelEncoder serializes a Level to a lowercase string and adds coloring.
LowercaseLevelEncoder serializes a Level to a lowercase string.
MillisDurationEncoder serializes a time.Duration to an integer number of milliseconds elapsed.
NanosDurationEncoder serializes a time.Duration to an integer number of nanoseconds elapsed.
NewConsoleEncoder creates an encoder whose output is designed for human - rather than machine - consumption.
NewCore creates a Core that writes logs to a WriteSyncer.
NewEntryCaller makes an EntryCaller from the return signature of runtime.Caller.
NewIncreaseLevelCore creates a core that can be used to increase the level of an existing Core.
NewJSONEncoder creates a fast, low-allocation JSON encoder.
NewLazyWith wraps a Core with a "lazy" Core that will only encode fields if the logger is written to (or is further chained in a lon-lazy manner).
NewMapObjectEncoder creates a new map-backed ObjectEncoder.
NewMultiWriteSyncer creates a WriteSyncer that duplicates its writes and sync calls, much like io.MultiWriter.
NewNopCore returns a no-op Core.
NewSampler creates a Core that samples incoming entries, which caps the CPU and I/O load of logging while attempting to preserve a representative subset of your logs.
NewSamplerWithOptions creates a Core that samples incoming entries, which caps the CPU and I/O load of logging while attempting to preserve a representative subset of your logs.
NewTee creates a Core that duplicates log entries into two or more underlying Cores.
ParseLevel parses a level based on the lower-case or all-caps ASCII representation of the log level.
RegisterHooks wraps a Core and runs a collection of user-defined callback hooks each time a message is logged.
RFC3339NanoTimeEncoder serializes a time.Time to an RFC3339-formatted string with nanosecond precision.
RFC3339TimeEncoder serializes a time.Time to an RFC3339-formatted string.
SamplerHook registers a function which will be called when Sampler makes a decision.
SecondsDurationEncoder serializes a time.Duration to a floating-point number of seconds elapsed.
ShortCallerEncoder serializes a caller in package/file:line format, trimming all but the final directory from the full path.
StringDurationEncoder serializes a time.Duration using its built-in String method.
TimeEncoderOfLayout returns TimeEncoder which serializes a time.Time using given layout.

# Constants

ArrayMarshalerType indicates that the field carries an ArrayMarshaler.
BinaryType indicates that the field carries an opaque binary blob.
BoolType indicates that the field carries a bool.
ByteStringType indicates that the field carries UTF-8 encoded bytes.
Complex128Type indicates that the field carries a complex128.
Complex64Type indicates that the field carries a complex64.
DebugLevel logs are typically voluminous, and are usually disabled in production.
DefaultLineEnding defines the default line ending when writing logs.
DPanicLevel logs are particularly important errors.
DurationType indicates that the field carries a time.Duration.
ErrorLevel logs are high-priority.
ErrorType indicates that the field carries an error.
FatalLevel logs a message, then calls os.Exit(1).
Float32Type indicates that the field carries a float32.
Float64Type indicates that the field carries a float64.
InfoLevel is the default logging priority.
InlineMarshalerType indicates that the field carries an ObjectMarshaler that should be inlined.
Int16Type indicates that the field carries an int16.
Int32Type indicates that the field carries an int32.
Int64Type indicates that the field carries an int64.
Int8Type indicates that the field carries an int8.
InvalidLevel is an invalid value for Level.
LogDropped indicates that the Sampler dropped a log entry.
LogSampled indicates that the Sampler sampled a log entry.
NamespaceType signals the beginning of an isolated namespace.
ObjectMarshalerType indicates that the field carries an ObjectMarshaler.
OmitKey defines the key to use when callers want to remove a key from log output.
PanicLevel logs a message, then panics.
ReflectType indicates that the field carries an interface{}, which should be serialized using reflection.
SkipType indicates that the field is a no-op.
StringerType indicates that the field carries a fmt.Stringer.
StringType indicates that the field carries a string.
TimeFullType indicates that the field carries a time.Time stored as-is.
TimeType indicates that the field carries a time.Time that is representable by a UnixNano() stored as an int64.
Uint16Type indicates that the field carries a uint16.
Uint32Type indicates that the field carries a uint32.
Uint64Type indicates that the field carries a uint64.
Uint8Type indicates that the field carries a uint8.
UintptrType indicates that the field carries a uintptr.
UnknownType is the default field type.
WarnLevel logs are more important than Info, but don't need individual human review.
WriteThenFatal causes an os.Exit(1) after Write.
WriteThenGoexit runs runtime.Goexit after Write.
WriteThenNoop indicates that nothing special needs to be done.
WriteThenPanic causes a panic after Write.

# Variables

DefaultClock is the default clock used by Zap in operations that require time.

# Structs

A BufferedWriteSyncer is a WriteSyncer that buffers writes in-memory before flushing them to a wrapped WriteSyncer after reaching some limit, or at some fixed interval--whichever comes first.
CheckedEntry is an Entry together with a collection of Cores that have already agreed to log it.
An EncoderConfig allows users to configure the concrete encoders supplied by zapcore.
Entry
An Entry represents a complete log message.
EntryCaller represents the caller of a logging function.
A Field is a marshaling operation used to add a key-value pair to a logger's context.
MapObjectEncoder is an ObjectEncoder backed by a simple map[string]interface{}.

# Interfaces

ArrayEncoder is a strongly-typed, encoding-agnostic interface for adding array-like objects to the logging context.
ArrayMarshaler allows user-defined types to efficiently add themselves to the logging context, and to selectively omit information which shouldn't be included in logs (e.g., passwords).
CheckWriteHook is a custom action that may be executed after an entry is written.
Clock is a source of time for logged entries.
Core is a minimal, fast logger interface.
Encoder is a format-agnostic interface for all log entry marshalers.
LevelEnabler decides whether a given logging level is enabled when logging a message.
ObjectEncoder is a strongly-typed, encoding-agnostic interface for adding a map- or struct-like object to the logging context.
ObjectMarshaler allows user-defined types to efficiently add themselves to the logging context, and to selectively omit information which shouldn't be included in logs (e.g., passwords).
PrimitiveArrayEncoder is the subset of the ArrayEncoder interface that deals only in Go's built-in types.
ReflectedEncoder serializes log fields that can't be serialized with Zap's JSON encoder.
SamplerOption configures a Sampler.
A WriteSyncer is an io.Writer that can also flush any buffered data.

# Type aliases

ArrayMarshalerFunc is a type adapter that turns a function into an ArrayMarshaler.
A CallerEncoder serializes an EntryCaller to a primitive type.
CheckWriteAction indicates what action to take after a log entry is processed.
A DurationEncoder serializes a time.Duration to a primitive type.
A FieldType indicates which member of the Field union struct should be used and how it should be serialized.
A Level is a logging priority.
A LevelEncoder serializes a Level to a primitive type.
A NameEncoder serializes a period-separated logger name to a primitive type.
ObjectMarshalerFunc is a type adapter that turns a function into an ObjectMarshaler.
SamplingDecision is a decision represented as a bit field made by sampler.
A TimeEncoder serializes a time.Time to a primitive type.