format

package
v0.20.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	// TimeFormat defines time.Format() layout to
	// use when appending a timestamp to log entry.
	TimeFormat string
	// contains filtered or unexported fields
}

func (*Base) AppendFormatStamp

func (b *Base) AppendFormatStamp(buf *byteutil.Buffer, stamp time.Time)

AppendFormatStamp will append given timestamp according to TimeFormat, caching recently formatted stamp strings to reduce number of Format() calls.

type FormatFunc

type FormatFunc func(buf *byteutil.Buffer, stamp time.Time, pc uintptr, lvl level.LEVEL, kvs []kv.Field, msg string) //nolint:revive

FormatFunc defines a function capable of formatting a log entry (args = 1+) to a given buffer (args = 0).

type JSON

type JSON struct{ Base }

func (*JSON) Format

func (fmt *JSON) Format(buf *byteutil.Buffer, stamp time.Time, pc uintptr, lvl level.LEVEL, kvs []kv.Field, msg string)

type Logfmt

type Logfmt struct{ Base }

func (*Logfmt) Format

func (fmt *Logfmt) Format(buf *byteutil.Buffer, stamp time.Time, pc uintptr, lvl level.LEVEL, kvs []kv.Field, msg string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL