output

package
v3.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 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 DefaultOutput

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

DefaultOutput provides logs and metadata in human readable format

func (*DefaultOutput) FormatAndPrintln

func (o *DefaultOutput) FormatAndPrintln(ts time.Time, lbls loghttp.LabelSet, maxLabelsLen int, line string)

Format a log entry in a human readable format

func (DefaultOutput) WithWriter

func (o DefaultOutput) WithWriter(w io.Writer) LogOutput

WithWriter returns a copy of the LogOutput with the writer set to the given writer

type JSONLOutput

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

JSONLOutput prints logs and metadata as JSON Lines, suitable for scripts

func (*JSONLOutput) FormatAndPrintln

func (o *JSONLOutput) FormatAndPrintln(ts time.Time, lbls loghttp.LabelSet, _ int, line string)

Format a log entry as json line

func (JSONLOutput) WithWriter

func (o JSONLOutput) WithWriter(w io.Writer) LogOutput

WithWriter returns a copy of the LogOutput with the writer set to the given writer

type LogOutput

type LogOutput interface {
	FormatAndPrintln(ts time.Time, lbls loghttp.LabelSet, maxLabelsLen int, line string)
	WithWriter(w io.Writer) LogOutput
}

LogOutput is the interface any output mode must implement

func NewLogOutput

func NewLogOutput(w io.Writer, mode string, options *LogOutputOptions) (LogOutput, error)

NewLogOutput creates a log output based on the input mode and options

func NewRaw

func NewRaw(writer io.Writer, options *LogOutputOptions) LogOutput

type LogOutputOptions

type LogOutputOptions struct {
	Timezone      *time.Location
	NoLabels      bool
	ColoredOutput bool
}

LogOutputOptions defines options supported by LogOutput

type RawOutput

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

RawOutput prints logs in their original form, without any metadata

func (*RawOutput) FormatAndPrintln

func (o *RawOutput) FormatAndPrintln(_ time.Time, _ loghttp.LabelSet, _ int, line string)

Format a log entry as is

func (RawOutput) WithWriter

func (o RawOutput) WithWriter(w io.Writer) LogOutput

WithWriter returns a copy of the LogOutput with the writer set to the given writer

Jump to

Keyboard shortcuts

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