output

package
v0.0.0-...-806114d Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Data is the customized logrus log used for stdout output.
	// Use this for data that can be piped to other applications.
	Data = log.New()
	// User is the customized logrus log used for stderr output.
	User = log.New()
	// UserFormatter is the formatter used for User output
	UserFormatter = new(PlainFormatter)
)

Functions

func PrettyString

func PrettyString(str string)

Types

type FlairedData

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

FlairedData is a struct that can be used to print data with surrounding flair.

func DataWithFlair

func DataWithFlair(data string) *FlairedData

DataWithFlair Prints only the data to stdout so it can be piped to other commands without including the surrounding text. Use Pre() and Post() methods to add surrounding text that will be displayed to the user but will not be included in the piped output.

func (*FlairedData) Post

func (f *FlairedData) Post(flair string) *FlairedData

Post sets the flair to be printed after the data.

func (*FlairedData) Pre

func (f *FlairedData) Pre(flair string) *FlairedData

Pre sets the flair to be printed before the data.

func (*FlairedData) Print

func (f *FlairedData) Print()

Print will output the flaired message

func (*FlairedData) Println

func (f *FlairedData) Println()

Println will output the flaired message followed by a line break

type PlainFormatter

type PlainFormatter struct{}

PlainFormatter defines a output formatter with no special frills

func (*PlainFormatter) Format

func (f *PlainFormatter) Format(entry *log.Entry) ([]byte, error)

Format is called by logrus to format the output. We just return the string as is.

Jump to

Keyboard shortcuts

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