formatter

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 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 JSON

type JSON struct{}

JSON formats a message as JSON.

func NewJSON

func NewJSON() JSON

NewJSON creates a new instance of FormatterJSON.

func (JSON) Format

func (f JSON) Format(buf *bytes.Buffer, message types.Message) error

Format implements Formatter.

type Plain

type Plain struct{}

Plain just formats the message as plain text.

func NewPlain

func NewPlain() Plain

NewPlain creates a new instance of Plain.

func (Plain) Format

func (f Plain) Format(buf *bytes.Buffer, message types.Message) error

Format implements Formatter.

type Template

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

Template formats a message using a predefined format string.

func NewTemplate

func NewTemplate(format string, opts ...TemplateOpt) (*Template, error)

NewMustache creates a new instance of Template.

func (*Template) Format

func (t *Template) Format(buf *bytes.Buffer, message types.Message) error

type TemplateOpt

type TemplateOpt func(m *Template)

TemplateOpt represents an option for the constructor.

func WithQuotes

func WithQuotes(openQuote, closeQuote rune) TemplateOpt

WithQuotes sets custom quote chars.

func WithTags

func WithTags(openTag, closeTag rune) TemplateOpt

WithTags sets custom open and close tags. To disable set to 0.

Jump to

Keyboard shortcuts

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