Documentation ¶
Index ¶
- type FormattedEncoder
- func (FormattedEncoder) CaddyModule() caddy.ModuleInfo
- func (se FormattedEncoder) Clone() zapcore.Encoder
- func (se FormattedEncoder) EncodeEntry(ent zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)
- func (se *FormattedEncoder) Provision(ctx caddy.Context) error
- func (se *FormattedEncoder) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FormattedEncoder ¶
type FormattedEncoder struct { logging.LogEncoderConfig zapcore.Encoder `json:"-"` Template string `json:"template,omitempty"` }
FormattedEncoder allows the user to provide custom template for log prints. The encoder builds atop the json encoder, thus it follows its message structure. The placeholders are namespaced by the name of the app logging the message.
func (FormattedEncoder) CaddyModule ¶
func (FormattedEncoder) CaddyModule() caddy.ModuleInfo
func (FormattedEncoder) Clone ¶
func (se FormattedEncoder) 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 FormattedEncoder's EncodeEntry.
func (FormattedEncoder) EncodeEntry ¶
func (se FormattedEncoder) EncodeEntry(ent zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)
EncodeEntry partially implements the zapcore.Encoder interface.
func (*FormattedEncoder) Provision ¶
func (se *FormattedEncoder) Provision(ctx caddy.Context) error
Provision sets up the encoder.
func (*FormattedEncoder) UnmarshalCaddyfile ¶
func (se *FormattedEncoder) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile sets up the module from Caddyfile tokens. Syntax:
formatted <template>
If the value of "template" is omitted, Common Log Format is assumed. See the godoc on the LogEncoderConfig type for the syntax of subdirectives that are common to most/all encoders.