formatter

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

nolint

nolint:forcetypeassert

nolint

nolint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonWithCallerPrettifier added in v1.5.0

func JsonWithCallerPrettifier(prettifierFunc CallerPrettifierFunc) func(f *JsonFormatter)

func JsonWithConfig

func JsonWithConfig(cfg log.FormatterSettings) func(f *JsonFormatter)

func JsonWithFieldMap added in v1.5.0

func JsonWithFieldMap(fieldMap FieldMap) func(f *JsonFormatter)

func NewFromConfig

func NewFromConfig(cfg log.FormatterConfig) log.Formatter

nolint:ireturn

func PlainTextWithCallerPrettifier added in v1.5.0

func PlainTextWithCallerPrettifier(prettifierFunc CallerPrettifierFunc) func(f *PlainTextFormatter)

func PlainTextWithConfig added in v1.5.0

func PlainTextWithConfig(cfg log.FormatterSettings) func(f *PlainTextFormatter)

func PlainTextWithFieldMap added in v1.5.0

func PlainTextWithFieldMap(fieldMap FieldMap) func(f *PlainTextFormatter)

Types

type CallerPrettifierFunc added in v1.5.0

type CallerPrettifierFunc func(*runtime.Frame) (function string, file string)

type FieldMap

type FieldMap map[string]string

FieldMap allows customization of the key names for default fields.

func NewFieldMap added in v1.5.0

func NewFieldMap(overrideFields map[string]string) FieldMap

type JsonFormatter

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

JsonFormatter formats logs into parsable json

func NewJsonFormatter

func NewJsonFormatter(options ...JsonOption) *JsonFormatter

func (*JsonFormatter) Format

func (f *JsonFormatter) Format(entry *log.Entry) ([]byte, error)

Format renders a single log entry

type JsonOption

type JsonOption func(f *JsonFormatter)

type PlainTextFormatter added in v1.5.0

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

func NewPlainTextFormatter added in v1.5.0

func NewPlainTextFormatter(options ...PlainTextOption) *PlainTextFormatter

func (*PlainTextFormatter) Format added in v1.5.0

func (f *PlainTextFormatter) Format(entry *log.Entry) ([]byte, error)

type PlainTextOption added in v1.5.0

type PlainTextOption func(f *PlainTextFormatter)

Jump to

Keyboard shortcuts

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