formatter

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// TextFormatter the text formatter type
	TextFormatter string = "text"
	// JsonFormatter the json formatter type
	JsonFormatter string = "json"
)

Variables

This section is empty.

Functions

func AppendRowTerminator

func AppendRowTerminator(format string) string

AppendRowTerminator append a terminator at the end of the row if that does not exist

func InitDefaultFormatter

func InitDefaultFormatter(t string)

InitDefaultFormatter init the global default Formatter by specified type

func Register

func Register(t string, formatter Formatter)

Register register a Formatter

Types

type Formatter

type Formatter interface {
	// Serialize serialize the log content to []byte
	Serialize(c content.Content) ([]byte, error)
}

Formatter the log formatter interface

func Default

func Default() Formatter

Default return the global default Formatter

func New

func New(t string) Formatter

New return a Formatter by specified type. if the specified Formatter does not exist and return the default Formatter.

func NewJsonFormatter

func NewJsonFormatter() Formatter

NewJsonFormatter return a json formatter

func NewTextFormatter

func NewTextFormatter() Formatter

NewTextFormatter return a text formatter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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