internal

package
v0.0.0-...-b1c5812 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONLogger

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

func NewJSONLogger

func NewJSONLogger(w io.Writer) *JSONLogger

NewJSONLogger creates a new JSONLogger which generates valid JSON ouputs and includes the same unique id in each log line generated through this logger.

func (*JSONLogger) Logln

func (j *JSONLogger) Logln(msg string, fields map[string]string)

func (*JSONLogger) Write

func (j *JSONLogger) Write(p []byte) (int, error)

Write implements the io.Writer interface. The input is expected to be log lines separated by newlines. If the log line is already valid JSON, the logger simply adds the id field. If the log line is not valid JSON, then the log line is wrapped in a JSON.

type PrefixWriter

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

PrefixWriter wraps an io.Writer to automatically add a prefix at the beginning of every line.

func NewPrefixWriter

func NewPrefixWriter(w io.Writer) *PrefixWriter

NewPrefixWriter creates a PrefixWriter.

func (*PrefixWriter) SetPrefix

func (w *PrefixWriter) SetPrefix(prefix []byte)

SetPrefix sets the prefix.

func (*PrefixWriter) Write

func (w *PrefixWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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