kprinter

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: AGPL-3.0 Imports: 8 Imported by: 2

README

kprinter

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PrintConfig = Config{
	NormalMode,
	InfoLevel,
	"",
	false,
	false,
	false,
}

Functions

func Blue

func Blue(text string) string

Green returns green colored text

func Bluef

func Bluef(text string, args ...any) string

Green returns green colored text

func Bold

func Bold(text string, args ...any) string

Bold returns bold text

func Debug

func Debug(format string)

Debug logs debug message with formatting

func Debugf

func Debugf(format string, args ...any)

Debugf logs debug message with formatting

func Error

func Error(format string)

Debugf logs debug message with formatting

func Errorf

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

Debugf logs debug message with formatting

func Fatal

func Fatal(format string)

Debugf logs debug message with formatting

func Fatalf

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

Debugf logs debug message with formatting

func Formatf

func Formatf(cf func(string, ...any) string, format string, args ...any) string

func Green

func Green(text string) string

Green returns green colored text

func Greenf

func Greenf(text string, args ...any) string

Green returns green colored text

func Info

func Info(format string)

Debug logs debug message with formatting

func Infof

func Infof(format string, args ...any)

Debugf logs debug message with formatting

func IsConsole

func IsConsole() bool

func Magenta

func Magenta(text string) string

Green returns green colored text

func Magentaf

func Magentaf(text string, args ...any) string

Green returns green colored text

func PrinterInit

func PrinterInit(conf Config) error

PrinterInit initializes the global logger based on PrintConfig.Mode

func Printf

func Printf(cf func(string, ...any) string, format string, args ...any)

func Red

func Red(text string) string

Red returns red colored text

func RedOnWhite

func RedOnWhite(text string) string

RedOnWhite returns red text on white background

func RedOnWhitef

func RedOnWhitef(text string, args ...any) string

RedOnWhite returns red text on white background

func Redf

func Redf(text string, args ...any) string

Red returns red colored text

func Verbose

func Verbose(format string, args ...any)

Verbose logs debug message with formatting

func Warn

func Warn(format string)

Debugf logs debug message with formatting

func Warnf

func Warnf(format string, args ...any)

Debugf logs debug message with formatting

func Yellow

func Yellow(text string) string

Green returns green colored text

func Yellowf

func Yellowf(text string, args ...any) string

Green returns green colored text

Types

type Config

type Config struct {
	Mode      PrintMode
	Level     LogLevel
	LogFile   string
	WarnToErr bool
	AllToErr  bool
	Silence   bool
}

type LogLevel

type LogLevel int
const (
	DebugLevel LogLevel = iota + 10
	InfoLevel
	WarnLevel
	ErrorLevel
	FatalLevel
)

type PrintMode

type PrintMode int
const (
	NormalMode PrintMode = iota
	ProductionMode
	FileMode
)

type Printer

type Printer interface {
	Debugf(format string, args ...any)
	Infof(format string, args ...any)
	Warnf(format string, args ...any)
	Errorf(format string, args ...any)
	Fatalf(format string, args ...any)
	Debug(format string)
	Info(format string)
	Warn(format string)
	Error(format string)
	Fatal(format string)
}
var GlobalPrinter Printer = colorConsole

func NewConsoleColorPrinter

func NewConsoleColorPrinter() Printer

func NewConsoleRawPrinter

func NewConsoleRawPrinter() Printer

func NewLoggerPrinter

func NewLoggerPrinter() Printer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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