logger

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RedColor   = "\033[31m"
	ResetColor = "\033[0m"
)

Variables

This section is empty.

Functions

func Error

func Error(v ...any)

Logs message to sderr

func Errorf

func Errorf(format string, v ...any)

Logs format message to stderr

func Fatal

func Fatal(v ...any)

Logs messages to stderr and exits with code 1

func Fatalf

func Fatalf(format string, v ...any)

Logs formated message to stderr and exits with code 1

func Print

func Print(v ...any)

Logs message to stdout if setQuiet was called with false

func Printf

func Printf(format string, v ...any)

Logs format message to stdout if setQuiet was called with false

func SetQuiet

func SetQuiet(quiet bool)

SetQuiet sets the global logger's quiet state

Types

type Logger

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

func NewLogger

func NewLogger(quiet bool) *Logger

func (*Logger) Error

func (l *Logger) Error(v ...any)

Error outputs an error message (always logs to stderr)

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...any)

Errorf outputs a formatted error message (always logs to stderr)

func (*Logger) Fatal

func (l *Logger) Fatal(v ...any)

Fatal logs an error message and exits with status code 1 (always logs to stderr)

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...any)

Fatalf logs a formatted error message and exits with status code 1 (always logs to stderr)

func (*Logger) Print

func (l *Logger) Print(v ...any)

func (*Logger) Printf

func (l *Logger) Printf(format string, v ...any)

func (*Logger) Quiet

func (l *Logger) Quiet() bool

func (*Logger) SetQuiet

func (l *Logger) SetQuiet(quiet bool)

Jump to

Keyboard shortcuts

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