Documentation
¶
Overview ¶
Package encoding provides named encoders with flag integration.
Index ¶
- func CallerEncoderFlag(encoder *CallerEncoder) flag.Value
- func DurationEncoderFlag(encoder *DurationEncoder) flag.Value
- func EncoderFlag(encoder *Encoder) flag.Value
- func LevelEncoderFlag(encoder *LevelEncoder) flag.Value
- func RegisterCallerEncoder(e CallerEncoder) error
- func RegisterDurationEncoder(e DurationEncoder) error
- func RegisterEncoder(e Encoder) error
- func RegisterLevelEncoder(e LevelEncoder) error
- func RegisterTimeEncoder(e TimeEncoder) error
- func TimeEncoderFlag(encoder *TimeEncoder) flag.Value
- type CallerEncoder
- type DurationEncoder
- type Encoder
- type LevelEncoder
- type TimeEncoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallerEncoderFlag ¶
func CallerEncoderFlag(encoder *CallerEncoder) flag.Value
CallerEncoderFlag returns a flag value for the encoder.
func DurationEncoderFlag ¶
func DurationEncoderFlag(encoder *DurationEncoder) flag.Value
DurationEncoderFlag returns a flag value for the encoder.
func EncoderFlag ¶
EncoderFlag returns a flag value for the encoder.
func LevelEncoderFlag ¶
func LevelEncoderFlag(encoder *LevelEncoder) flag.Value
LevelEncoderFlag returns a flag value for the encoder.
func RegisterCallerEncoder ¶
func RegisterCallerEncoder(e CallerEncoder) error
RegisterCallerEncoder registers the CallerEncoder for use as a flag argument.
func RegisterDurationEncoder ¶
func RegisterDurationEncoder(e DurationEncoder) error
RegisterDurationEncoder registers the DurationEncoder for use as a flag argument.
func RegisterEncoder ¶
RegisterEncoder registers the Encoder for use as a flag argument.
func RegisterLevelEncoder ¶
func RegisterLevelEncoder(e LevelEncoder) error
RegisterLevelEncoder registers the LevelEncoder for use as a flag argument.
func RegisterTimeEncoder ¶
func RegisterTimeEncoder(e TimeEncoder) error
RegisterTimeEncoder registers the TimeEncoder for use as a flag argument.
func TimeEncoderFlag ¶
func TimeEncoderFlag(encoder *TimeEncoder) flag.Value
TimeEncoderFlag returns a flag value for the encoder.
Types ¶
type CallerEncoder ¶
type CallerEncoder interface { CallerEncoder() zapcore.CallerEncoder Name() string }
A CallerEncoder provides a named zapcore.CallerEncoder.
func CallerEncoders ¶
func CallerEncoders() []CallerEncoder
CallerEncoders returns the registered CallerEncoders.
func FullCallerEncoder ¶
func FullCallerEncoder() CallerEncoder
FullCallerEncoder serializes a caller in /full/path/to/package/file:line format.
func ShortCallerEncoder ¶
func ShortCallerEncoder() CallerEncoder
ShortCallerEncoder serializes a caller in package/file:line format, trimming all but the final directory from the full path.
type DurationEncoder ¶
type DurationEncoder interface { DurationEncoder() zapcore.DurationEncoder Name() string }
A DurationEncoder provides a named zapcore.DurationEncoder.
func DurationEncoders ¶
func DurationEncoders() []DurationEncoder
DurationEncoders returns the registered DurationEncoders.
func MillisecondsDurationEncoder ¶
func MillisecondsDurationEncoder() DurationEncoder
MillisecondsDurationEncoder serializes a time.Duration to a floating-point number of milliseconds.
func NanosecondsDurationEncoder ¶
func NanosecondsDurationEncoder() DurationEncoder
NanosecondsDurationEncoder serializes a time.Duration to an integer number of nanoseconds.
func SecondsDurationEncoder ¶
func SecondsDurationEncoder() DurationEncoder
SecondsDurationEncoder serializes a time.Duration to a floating-point number of seconds.
func StringDurationEncoder ¶
func StringDurationEncoder() DurationEncoder
StringDurationEncoder serializes a time.Duration using its String method.
type Encoder ¶
type Encoder interface { NewEncoder(zapcore.EncoderConfig) zapcore.Encoder Name() string }
An Encoder provides a named zapcore.Encoder.
func ConsoleEncoder ¶
func ConsoleEncoder() Encoder
ConsoleEncoder creates an encoder whose output is designed for human consumption, rather than machine consumption.
func JSONEncoder ¶
func JSONEncoder() Encoder
JSONEncoder creates a fast, low-allocation JSON encoder.
type LevelEncoder ¶
type LevelEncoder interface { LevelEncoder() zapcore.LevelEncoder Name() string }
A LevelEncoder provides a named zapcore.LevelEncoder.
func ColorLevelEncoder ¶
func ColorLevelEncoder() LevelEncoder
ColorLevelEncoder serializes a Level to an all-caps string and adds color. For example, InfoLevel is serialized to "INFO" and colored blue.
func LevelEncoders ¶
func LevelEncoders() []LevelEncoder
LevelEncoders returns the registered LevelEncoders.
func LowercaseLevelEncoder ¶
func LowercaseLevelEncoder() LevelEncoder
LowercaseLevelEncoder serializes a Level to a lowercase string. For example, InfoLevel is serialized to "info".
func UppercaseLevelEncoder ¶
func UppercaseLevelEncoder() LevelEncoder
UppercaseLevelEncoder serializes a Level to an all-caps string. For example, InfoLevel is serialized to "INFO".
type TimeEncoder ¶
type TimeEncoder interface { TimeEncoder() zapcore.TimeEncoder Name() string }
A TimeEncoder provides a named zapcore.TimeEncoder.
func ISO8601TimeEncoder ¶
func ISO8601TimeEncoder() TimeEncoder
ISO8601TimeEncoder serializes a time.Time to an ISO8601-formatted string with millisecond precision.
func MillisecondsTimeEncoder ¶
func MillisecondsTimeEncoder() TimeEncoder
MillisecondsTimeEncoder serializes a time.Time to a floating-point number of milliseconds since the Unix epoch.
func NanosecondsTimeEncoder ¶
func NanosecondsTimeEncoder() TimeEncoder
NanosecondsTimeEncoder serializes a time.Time to an integer number of nanoseconds since the Unix epoch.
func RFC3339TimeEncoder ¶
func RFC3339TimeEncoder() TimeEncoder
RFC3339TimeEncoder serializes a time.Time to an RFC3339-formatted string with millisecond precision.
func SecondsTimeEncoder ¶
func SecondsTimeEncoder() TimeEncoder
SecondsTimeEncoder serializes a time.Time to a floating-point number of seconds since the Unix epoch.
func TimeEncoders ¶
func TimeEncoders() []TimeEncoder
TimeEncoders returns the registered TimeEncoders.