formatter

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultConsoleTimeLayout      string = "15:04:05.000"
	DefaultConsoleMinMessageWidth int16  = 50
	DefaultConsoleLevelWidth      int8   = -5
)
View Source
const (
	DefaultLevelKey = "level"
)

Variables

View Source
var (
	DefaultConsole = NewConsole()
)
View Source
var (
	DefaultJson = NewJson()
)

Functions

This section is empty.

Types

type Aware

type Aware interface {
	GetFormatter() Formatter
	SetFormatter(Formatter)
}

type Console

type Console struct {
	PrintGlobalLogger bool
	ColorMode         color.Mode

	MinMessageWidth *int16
	LevelWidth      *int8

	LevelBasedColorizer color.LevelBasedColorizer

	TimeLayout          string
	FieldValueFormatter ValueFormatter
}

func NewConsole

func NewConsole() *Console

func (*Console) Format

func (instance *Console) Format(event log.Event, using log.Provider, h hints.Hints) ([]byte, error)

type FieldValueFormatterAware

type FieldValueFormatterAware interface {
	GetValueFormatter() ValueFormatter
	SetValueFormatter(ValueFormatter)
}

type Formatter

type Formatter interface {
	Format(log.Event, log.Provider, hints.Hints) ([]byte, error)
}
var (
	Default Formatter = DefaultConsole
)

type Json

type Json struct {
	LevelKey          string
	PrintGlobalLogger bool
}

func NewJson

func NewJson() *Json

func (*Json) Format

func (instance *Json) Format(event log.Event, using log.Provider, _ hints.Hints) ([]byte, error)

type QuoteType

type QuoteType uint8
const (
	QuoteTypeMinimal    QuoteType = 0
	QuoteTypeNormal     QuoteType = 1
	QuoteTypeEverything QuoteType = 2
)

type SimpleValueFormatter

type SimpleValueFormatter struct {
	QuoteType QuoteType
}

func (*SimpleValueFormatter) FormatValue

func (instance *SimpleValueFormatter) FormatValue(v interface{}, _ log.Provider) ([]byte, error)

type ValueFormatter

type ValueFormatter interface {
	FormatValue(interface{}, log.Provider) ([]byte, error)
}
var (
	DefaultValueFormatter ValueFormatter = &SimpleValueFormatter{}
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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