Documentation ¶
Index ¶
- type ConsoleEncoder
- type DeleteFilter
- type FileWriter
- type FilterEncoder
- func (fe FilterEncoder) AddArray(key string, marshaler zapcore.ArrayMarshaler) error
- func (fe FilterEncoder) AddBinary(key string, value []byte)
- func (fe FilterEncoder) AddBool(key string, value bool)
- func (fe FilterEncoder) AddByteString(key string, value []byte)
- func (fe FilterEncoder) AddComplex128(key string, value complex128)
- func (fe FilterEncoder) AddComplex64(key string, value complex64)
- func (fe FilterEncoder) AddDuration(key string, value time.Duration)
- func (fe FilterEncoder) AddFloat32(key string, value float32)
- func (fe FilterEncoder) AddFloat64(key string, value float64)
- func (fe FilterEncoder) AddInt(key string, value int)
- func (fe FilterEncoder) AddInt16(key string, value int16)
- func (fe FilterEncoder) AddInt32(key string, value int32)
- func (fe FilterEncoder) AddInt64(key string, value int64)
- func (fe FilterEncoder) AddInt8(key string, value int8)
- func (fe FilterEncoder) AddObject(key string, marshaler zapcore.ObjectMarshaler) error
- func (fe FilterEncoder) AddReflected(key string, value interface{}) error
- func (fe FilterEncoder) AddString(key, value string)
- func (fe FilterEncoder) AddTime(key string, value time.Time)
- func (fe FilterEncoder) AddUint(key string, value uint)
- func (fe FilterEncoder) AddUint16(key string, value uint16)
- func (fe FilterEncoder) AddUint32(key string, value uint32)
- func (fe FilterEncoder) AddUint64(key string, value uint64)
- func (fe FilterEncoder) AddUint8(key string, value uint8)
- func (fe FilterEncoder) AddUintptr(key string, value uintptr)
- func (FilterEncoder) CaddyModule() caddy.ModuleInfo
- func (fe FilterEncoder) Clone() zapcore.Encoder
- func (fe FilterEncoder) EncodeEntry(ent zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)
- func (fe FilterEncoder) OpenNamespace(key string)
- func (fe *FilterEncoder) Provision(ctx caddy.Context) error
- type IPMaskFilter
- type JSONEncoder
- type LogEncoderConfig
- type LogFieldFilter
- type LogfmtEncoder
- type StringEncoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsoleEncoder ¶
type ConsoleEncoder struct { zapcore.Encoder LogEncoderConfig }
ConsoleEncoder encodes log entries that are mostly human-readable.
func (ConsoleEncoder) CaddyModule ¶
func (ConsoleEncoder) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*ConsoleEncoder) Provision ¶
func (ce *ConsoleEncoder) Provision(_ caddy.Context) error
Provision sets up the encoder.
type DeleteFilter ¶
type DeleteFilter struct{}
DeleteFilter is a Caddy log field filter that deletes the field.
func (DeleteFilter) CaddyModule ¶
func (DeleteFilter) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
type FileWriter ¶
type FileWriter struct { Filename string `json:"filename,omitempty"` Roll *bool `json:"roll,omitempty"` RollSizeMB int `json:"roll_size_mb,omitempty"` RollCompress *bool `json:"roll_gzip,omitempty"` RollLocalTime bool `json:"roll_local_time,omitempty"` RollKeep int `json:"roll_keep,omitempty"` RollKeepDays int `json:"roll_keep_days,omitempty"` }
FileWriter can write logs to files.
func (FileWriter) CaddyModule ¶
func (FileWriter) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (FileWriter) OpenWriter ¶
func (fw FileWriter) OpenWriter() (io.WriteCloser, error)
OpenWriter opens a new file writer.
func (FileWriter) String ¶
func (fw FileWriter) String() string
func (FileWriter) WriterKey ¶
func (fw FileWriter) WriterKey() string
WriterKey returns a unique key representing this fw.
type FilterEncoder ¶
type FilterEncoder struct { WrappedRaw json.RawMessage `json:"wrap,omitempty"` FieldsRaw map[string]json.RawMessage `json:"fields,omitempty"` Fields map[string]LogFieldFilter `json:"-"` // contains filtered or unexported fields }
FilterEncoder wraps an underlying encoder. It does not do any encoding itself, but it can manipulate (filter) fields before they are actually encoded. A wrapped encoder is required.
func (FilterEncoder) AddArray ¶
func (fe FilterEncoder) AddArray(key string, marshaler zapcore.ArrayMarshaler) error
AddArray is part of the zapcore.ObjectEncoder interface. Array elements do not get filtered.
func (FilterEncoder) AddBinary ¶
func (fe FilterEncoder) AddBinary(key string, value []byte)
AddBinary is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddBool ¶
func (fe FilterEncoder) AddBool(key string, value bool)
AddBool is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddByteString ¶
func (fe FilterEncoder) AddByteString(key string, value []byte)
AddByteString is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddComplex128 ¶
func (fe FilterEncoder) AddComplex128(key string, value complex128)
AddComplex128 is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddComplex64 ¶
func (fe FilterEncoder) AddComplex64(key string, value complex64)
AddComplex64 is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddDuration ¶
func (fe FilterEncoder) AddDuration(key string, value time.Duration)
AddDuration is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddFloat32 ¶
func (fe FilterEncoder) AddFloat32(key string, value float32)
AddFloat32 is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddFloat64 ¶
func (fe FilterEncoder) AddFloat64(key string, value float64)
AddFloat64 is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddInt ¶
func (fe FilterEncoder) AddInt(key string, value int)
AddInt is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddInt16 ¶
func (fe FilterEncoder) AddInt16(key string, value int16)
AddInt16 is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddInt32 ¶
func (fe FilterEncoder) AddInt32(key string, value int32)
AddInt32 is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddInt64 ¶
func (fe FilterEncoder) AddInt64(key string, value int64)
AddInt64 is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddInt8 ¶
func (fe FilterEncoder) AddInt8(key string, value int8)
AddInt8 is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddObject ¶
func (fe FilterEncoder) AddObject(key string, marshaler zapcore.ObjectMarshaler) error
AddObject is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddReflected ¶
func (fe FilterEncoder) AddReflected(key string, value interface{}) error
AddReflected is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddString ¶
func (fe FilterEncoder) AddString(key, value string)
AddString is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddTime ¶
func (fe FilterEncoder) AddTime(key string, value time.Time)
AddTime is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddUint ¶
func (fe FilterEncoder) AddUint(key string, value uint)
AddUint is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddUint16 ¶
func (fe FilterEncoder) AddUint16(key string, value uint16)
AddUint16 is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddUint32 ¶
func (fe FilterEncoder) AddUint32(key string, value uint32)
AddUint32 is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddUint64 ¶
func (fe FilterEncoder) AddUint64(key string, value uint64)
AddUint64 is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddUint8 ¶
func (fe FilterEncoder) AddUint8(key string, value uint8)
AddUint8 is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) AddUintptr ¶
func (fe FilterEncoder) AddUintptr(key string, value uintptr)
AddUintptr is part of the zapcore.ObjectEncoder interface.
func (FilterEncoder) CaddyModule ¶
func (FilterEncoder) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (FilterEncoder) Clone ¶
func (fe FilterEncoder) Clone() zapcore.Encoder
Clone is part of the zapcore.ObjectEncoder interface. We don't use it as of Oct 2019 (v2 beta 7), I'm not really sure what it'd be useful for in our case.
func (FilterEncoder) EncodeEntry ¶
func (fe FilterEncoder) EncodeEntry(ent zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)
EncodeEntry partially implements the zapcore.Encoder interface.
func (FilterEncoder) OpenNamespace ¶
func (fe FilterEncoder) OpenNamespace(key string)
OpenNamespace is part of the zapcore.ObjectEncoder interface.
func (*FilterEncoder) Provision ¶
func (fe *FilterEncoder) Provision(ctx caddy.Context) error
Provision sets up the encoder.
type IPMaskFilter ¶
type IPMaskFilter struct { IPv4CIDR int `json:"ipv4_cidr,omitempty"` IPv6CIDR int `json:"ipv6_cidr,omitempty"` }
IPMaskFilter is a Caddy log field filter that masks IP addresses.
func (IPMaskFilter) CaddyModule ¶
func (IPMaskFilter) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
type JSONEncoder ¶
type JSONEncoder struct { zapcore.Encoder *LogEncoderConfig }
JSONEncoder encodes entries as JSON.
func (JSONEncoder) CaddyModule ¶
func (JSONEncoder) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*JSONEncoder) Provision ¶
func (je *JSONEncoder) Provision(_ caddy.Context) error
Provision sets up the encoder.
type LogEncoderConfig ¶
type LogEncoderConfig struct { MessageKey *string `json:"message_key,omitempty"` LevelKey *string `json:"level_key,omitempty"` TimeKey *string `json:"time_key,omitempty"` NameKey *string `json:"name_key,omitempty"` CallerKey *string `json:"caller_key,omitempty"` StacktraceKey *string `json:"stacktrace_key,omitempty"` LineEnding *string `json:"line_ending,omitempty"` TimeFormat string `json:"time_format,omitempty"` DurationFormat string `json:"duration_format,omitempty"` LevelFormat string `json:"level_format,omitempty"` }
LogEncoderConfig holds configuration common to most encoders.
func (*LogEncoderConfig) ZapcoreEncoderConfig ¶
func (lec *LogEncoderConfig) ZapcoreEncoderConfig() zapcore.EncoderConfig
ZapcoreEncoderConfig returns the equivalent zapcore.EncoderConfig. If lec is nil, zap.NewProductionEncoderConfig() is returned.
type LogFieldFilter ¶
LogFieldFilter can filter (or manipulate) a field in a log entry. If delete is true, out will be ignored and the field will be removed from the output.
type LogfmtEncoder ¶
type LogfmtEncoder struct { zapcore.Encoder LogEncoderConfig }
LogfmtEncoder encodes log entries as logfmt: https://www.brandur.org/logfmt
func (LogfmtEncoder) CaddyModule ¶
func (LogfmtEncoder) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*LogfmtEncoder) Provision ¶
func (lfe *LogfmtEncoder) Provision(_ caddy.Context) error
Provision sets up the encoder.
type StringEncoder ¶
type StringEncoder struct { zapcore.Encoder FieldName string `json:"field,omitempty"` FallbackRaw json.RawMessage `json:"fallback,omitempty"` }
StringEncoder writes a log entry that consists entirely of a single string field in the log entry. This is useful for custom, self-encoded log entries that consist of a single field in the structured log entry.
func (StringEncoder) CaddyModule ¶
func (StringEncoder) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (StringEncoder) Clone ¶
func (se StringEncoder) Clone() zapcore.Encoder
Clone wraps the underlying encoder's Clone. This is necessary because we implement our own EncodeEntry, and if we simply let the embedded encoder's Clone be promoted, it would return a clone of that, and we'd lose our StringEncoder's EncodeEntry.
func (StringEncoder) EncodeEntry ¶
func (se StringEncoder) EncodeEntry(ent zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)
EncodeEntry partially implements the zapcore.Encoder interface.
func (*StringEncoder) Provision ¶
func (se *StringEncoder) Provision(ctx caddy.Context) error
Provision sets up the encoder.