formatter

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	FieldKeyMsg      = "msg"
	FieldKeyLevel    = "level"
	FieldKeyTime     = "time"
	FieldKeyLogError = "log_error"
	FieldKeyFunc     = "func"
	FieldKeyFile     = "file"
)

Default key names for the default fields

Variables

This section is empty.

Functions

func JsonWithConfig

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

func NewFromConfig

func NewFromConfig(cfg log.FormatterConfig) log.Formatter

nolint:ireturn

Types

type FieldMap

type FieldMap map[fieldKey]string

FieldMap allows customization of the key names for default fields.

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)

Jump to

Keyboard shortcuts

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