logger

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 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 FunLogger

type FunLogger struct {
	// The logs are `io.Copy`'d to this in a mutex. It's common to set this to a
	// file, or leave it default which is `os.Stderr`. You can also set this to
	// something more adventurous, such as logging to Kafka.
	Out io.Writer
	// Function to exit the application, defaults to `os.Exit()`
	ExitFunc exitFunc
	// Done is a channel that can be used to stop the loading animation.
	Done chan struct{}
	// Fail is a channel that can be used to stop the loading animation and print a failure message.
	Fail chan struct{}
	// Wg is a WaitGroup that can be used to wait for the loading animation to finish.
	Wg *sync.WaitGroup
}

FunFonts implements the Logger interface using emojis for messages.

func NewLogger

func NewLogger() *FunLogger

NewLogger creates a new instance of FunLogger.

func (*FunLogger) Check

func (l *FunLogger) Check(format string, a ...any)

Info prints an information message with a check emoji.

func (*FunLogger) Error

func (l *FunLogger) Error(err error)

Error prints an error message with an X emoji.

func (*FunLogger) Exit

func (l *FunLogger) Exit(code int)

func (*FunLogger) Info

func (l *FunLogger) Info(format string, a ...any)

Info prints an information message with no emoji.

func (*FunLogger) Loading

func (l *FunLogger) Loading(format string, a ...any)

func (*FunLogger) Warning

func (l *FunLogger) Warning(format string, a ...any)

Warning prints a warning message with a warning emoji.

type Logger

type Logger interface {
	Info(format string, a ...any)
	Check(format string, a ...any)
	Warning(format string, a ...any)
	Error(err error)
	Loading(loadingMessage string)
}

Printer interface defines methods for logging info, warning, and error messages.

Jump to

Keyboard shortcuts

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