fields

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LocaleTime          = "15:04:05"
	ISO8601             = "2006-01-02T15:04:05.000"
	ISO8601WithTzOffset = "2006-01-02T15:04:05.000-07:00"
	AbsoluteTime        = "15:04:05.000"
	Datetime            = "2006/01/02-15:04:05"
)

Variables

View Source
var (
	ColorReset   = &Color{"reset", "\033[0m"}
	ColorRed     = &Color{"red", "\033[31m"}
	ColorGreen   = &Color{"green", "\033[32m"}
	ColorYellow  = &Color{"yellow", "\033[33m"}
	ColorBlue    = &Color{"blue", "\033[34m"}
	ColorMagenta = &Color{"magenta", "\033[35m"}
	ColorCyan    = &Color{"cyan", "\033[36m"}
)
View Source
var (
	ErrNilPointer  = errors.New("nil pointer")
	ErrEmptyReader = errors.New("readed all data available")
)
View Source
var (
	ErrUnkownVerb  = errors.New("unkown field verb")
	ErrTruncFormat = errors.New("incorrect truncation format")
	ErrPadFormat   = errors.New("incorrect padding format")
)

Functions

func NewPercentField

func NewPercentField() *singleCharField

Types

type Color

type Color struct {
	Name string
	Code string
}

type ColorField

type ColorField struct{}

func (*ColorField) WriteTo

func (c *ColorField) WriteTo(w io.Writer, reader *EventReader) (n int, err error)

type ColorResetField

type ColorResetField struct{}

func (*ColorResetField) WriteTo

func (c *ColorResetField) WriteTo(w io.Writer, _ *EventReader) (n int, err error)

type DateField

type DateField struct {
	// contains filtered or unexported fields
}

func NewDateField

func NewDateField(layout string) *DateField

func (*DateField) WriteTo

func (d *DateField) WriteTo(w io.Writer, _ *EventReader) (n int, err error)

type EventReader

type EventReader struct {
	*events.Event
	// contains filtered or unexported fields
}

func NewEventReader

func NewEventReader(e *events.Event) (*EventReader, error)

func (*EventReader) ReadData

func (r *EventReader) ReadData() (any, error)

type Field

type Field interface {
	WriteTo(io.Writer, *EventReader) (n int, err error)
}

func NewField

func NewField(r *strings.Reader) (f Field, err error)

type HostnameField

type HostnameField struct{}

func (*HostnameField) WriteTo

func (h *HostnameField) WriteTo(w io.Writer, reader *EventReader) (n int, err error)

type LocaleTimeField

type LocaleTimeField = DateField

func NewLocaleTimeField

func NewLocaleTimeField() *LocaleTimeField

type LogCategoryField

type LogCategoryField struct{}

func (*LogCategoryField) WriteTo

func (l *LogCategoryField) WriteTo(w io.Writer, reader *EventReader) (n int, err error)

type LogLevelField

type LogLevelField struct{}

func (*LogLevelField) WriteTo

func (l *LogLevelField) WriteTo(w io.Writer, reader *EventReader) (n int, err error)

type MessageField

type MessageField struct {
	// contains filtered or unexported fields
}

func NewMessageField

func NewMessageField(limits string) *MessageField

func (*MessageField) WriteTo

func (m *MessageField) WriteTo(w io.Writer, reader *EventReader) (n int, err error)

type NewLineField

type NewLineField = singleCharField

func NewNewLineField

func NewNewLineField() *NewLineField

type PaddingField

type PaddingField struct {
	Field
	// contains filtered or unexported fields
}

func NewPaddingField

func NewPaddingField(f Field, p int) *PaddingField

func (*PaddingField) WriteTo

func (p *PaddingField) WriteTo(w io.Writer, reader *EventReader) (n int, err error)

type PercentField

type PercentField = singleCharField

type ProcessIdField

type ProcessIdField struct{}

func (*ProcessIdField) WriteTo

func (p *ProcessIdField) WriteTo(w io.Writer, reader *EventReader) (n int, err error)

type TextField

type TextField struct {
	// contains filtered or unexported fields
}

func NewTextField

func NewTextField(b []byte) *TextField

func (*TextField) WriteTo

func (t *TextField) WriteTo(w io.Writer, _ *EventReader) (n int, err error)

type TruncationField

type TruncationField struct {
	Field
	// contains filtered or unexported fields
}

func (*TruncationField) WriteTo

func (t *TruncationField) WriteTo(w io.Writer, reader *EventReader) (n int, err error)

Jump to

Keyboard shortcuts

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