text

package
v0.0.0-...-660a5ed Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FmtText

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

FmtText struct describes the different manipulations and processing that a Text LogFormatter can apply to a LogMessage

func (*FmtText) FmtMetadata

func (f *FmtText) FmtMetadata(data map[string]interface{}) string

FmtMetadata method is a general-purpose converter for map[string]interface{} metadata, to display it in a somewhat human readable format, as a string.

func (*FmtText) Format

func (f *FmtText) Format(log *event.Event) (buf []byte, err error)

Format method will take in a pointer to an event.Event; and returns a buffer and an error.

This method will process the input event.Event and marshal it according to this LogFormatter

type FmtTextBuilder

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

FmtTextBuilder struct will define the base of a custom FmtText object, which will take in different options in the form of methods that will define its configuration.

Then, the Build() method can be called to return a FmtText object

func New

func New() *FmtTextBuilder

New function will initialize a FmtTextBuilder

func (*FmtTextBuilder) Build

func (b *FmtTextBuilder) Build() *FmtText

Build method will ensure the mandatory elements of FmtText are set and set them as default if otherwise, returning a pointer to a (custom) FmtText object

func (*FmtTextBuilder) Color

func (b *FmtTextBuilder) Color() *FmtTextBuilder

Color method will set a FmtTextBuilder's colored element to true, and return itself to allow method chaining

func (*FmtTextBuilder) DoubleSpace

func (b *FmtTextBuilder) DoubleSpace() *FmtTextBuilder

DoubleSpace method will set a FmtTextBuilder's doubleSpace element to true, and return itself to allow method chaining

func (*FmtTextBuilder) LevelFirst

func (b *FmtTextBuilder) LevelFirst() *FmtTextBuilder

LevelFirst method will set a FmtTextBuilder's levelFirst element to true, and return itself to allow method chaining

func (*FmtTextBuilder) NoHeaders

func (b *FmtTextBuilder) NoHeaders() *FmtTextBuilder

NoHeaders method will set a FmtTextBuilder's noHeaders element to true, and return itself to allow method chaining

func (*FmtTextBuilder) NoLevel

func (b *FmtTextBuilder) NoLevel() *FmtTextBuilder

NoLevel method will set a FmtTextBuilder's noLevel element to true, and return itself to allow method chaining

func (*FmtTextBuilder) NoTimestamp

func (b *FmtTextBuilder) NoTimestamp() *FmtTextBuilder

NoTimestamp method will set a FmtTextBuilder's noTimestamp element to true, and return itself to allow method chaining

func (*FmtTextBuilder) Time

Time method will set a FmtTextBuilder's timeFormat, and return itself to allow method chaining

func (*FmtTextBuilder) Upper

func (b *FmtTextBuilder) Upper() *FmtTextBuilder

Upper method will set a FmtTextBuilder's upper element to true, and return itself to allow method chaining

type LogTimestamp

type LogTimestamp string

LogTimestamp type will define the compatible timestamp formatting strings which can be used

const (
	LTRFC3339Nano LogTimestamp = time.RFC3339Nano
	LTRFC3339     LogTimestamp = time.RFC3339
	LTRFC822Z     LogTimestamp = time.RFC822Z
	LTRubyDate    LogTimestamp = time.RubyDate
	LTUnixNano    LogTimestamp = "UNIX_NANO"
	LTUnixMilli   LogTimestamp = "UNIX_MILLI"
	LTUnixMicro   LogTimestamp = "UNIX_MICRO"
)

func (LogTimestamp) String

func (lt LogTimestamp) String() string

String method is an implementation of the Stringer interface, to idiomatically convert a LogTimestamp into its string representation

Jump to

Keyboard shortcuts

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