conslogging

package
v0.4.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: MPL-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// NoPadding means the old behavior of printing the full target only.
	NoPadding int = -1
	// DefaultPadding always prints 20 characters for the target, right
	// justified. If it is longer, it prints the right 20 characters.
	DefaultPadding int = 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ColorMode added in v0.3.0

type ColorMode int

ColorMode is the mode in which colors are represented in the output.

const (
	// AutoColor automatically detects the presence of a TTY to decide if
	// color should be used.
	AutoColor ColorMode = iota
	// NoColor disables use of color.
	NoColor
	// ForceColor forces use of color.
	ForceColor
)

type ConsoleLogger

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

ConsoleLogger is a writer for consoles.

func Current

func Current(colorMode ColorMode, prefixPadding int) ConsoleLogger

Current returns the current console.

func (ConsoleLogger) Prefix

func (cl ConsoleLogger) Prefix() string

Prefix returns the console's prefix.

func (ConsoleLogger) PrintBytes

func (cl ConsoleLogger) PrintBytes(data []byte)

PrintBytes prints bytes directly to the console.

func (ConsoleLogger) PrintFailure added in v0.3.0

func (cl ConsoleLogger) PrintFailure()

PrintFailure prints the failure message.

func (ConsoleLogger) PrintSuccess

func (cl ConsoleLogger) PrintSuccess()

PrintSuccess prints the success message.

func (ConsoleLogger) Printf

func (cl ConsoleLogger) Printf(format string, args ...interface{})

Printf prints formatted text to the console.

func (ConsoleLogger) Warnf added in v0.2.0

func (cl ConsoleLogger) Warnf(format string, args ...interface{})

Warnf prints a warning message in red to errWriter

func (ConsoleLogger) WithCached

func (cl ConsoleLogger) WithCached(isCached bool) ConsoleLogger

WithCached returns a ConsoleLogger with isCached flag set accordingly.

func (ConsoleLogger) WithFailed added in v0.3.0

func (cl ConsoleLogger) WithFailed(isFailed bool) ConsoleLogger

WithFailed returns a ConsoleLogger with isFailed flag set accordingly.

func (ConsoleLogger) WithMetadataMode added in v0.3.15

func (cl ConsoleLogger) WithMetadataMode(metadataMode bool) ConsoleLogger

WithMetadataMode returns a ConsoleLogger with metadata printing mode set.

func (ConsoleLogger) WithPrefix

func (cl ConsoleLogger) WithPrefix(prefix string) ConsoleLogger

WithPrefix returns a ConsoleLogger with a prefix added.

func (ConsoleLogger) WithPrefixAndSalt added in v0.3.0

func (cl ConsoleLogger) WithPrefixAndSalt(prefix string, salt string) ConsoleLogger

WithPrefixAndSalt returns a ConsoleLogger with a prefix and a seed added.

Jump to

Keyboard shortcuts

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