logger

package
v0.0.0-...-ca15858 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: GPL-3.0 Imports: 9 Imported by: 23

Documentation

Overview

Package logger provides logging services

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanLine

func CleanLine()

func Error

func Error(v ...any)

func Fatal

func Fatal(v ...any)

func GetLoggerWriter

func GetLoggerWriter() io.Writer

func Info

func Info(v ...any)

func InfoB

func InfoB(v ...any)

func InfoBB

func InfoBB(v ...any)

func InfoBC

func InfoBC(v ...any)

func InfoBG

func InfoBG(v ...any)

func InfoBM

func InfoBM(v ...any)

func InfoBR

func InfoBR(v ...any)

func InfoBW

func InfoBW(v ...any)

func InfoBY

func InfoBY(v ...any)

func InfoC

func InfoC(v ...any)

func InfoG

func InfoG(v ...any)

func InfoM

func InfoM(v ...any)

func InfoR

func InfoR(v ...any)

func InfoTable

func InfoTable(v ...any)

func InfoW

func InfoW(v ...any)

func InfoY

func InfoY(v ...any)

func IsTerminal

func IsTerminal() bool

func LogTimerOn

func LogTimerOn() bool

func Panic

func Panic(v ...any)

func PctProgress

func PctProgress(done int32, total int, tick int32)

func Progress

func Progress(tick bool, v ...any)

func SetLoggerWriter

func SetLoggerWriter(w io.Writer)

SetLoggerWriter sets the writer to which log messages are written. Do not send nil as a writer if you wish to disable logging. Instead, use

w := logger.GetLoggerWriter()
defer logger.SetLoggerWriter(w)
logger.SetLoggerWriter(io.Discard)

Setting to `nil` will core dump.

func SetTestMode

func SetTestMode(onOff bool)

func TestLog

func TestLog(notDefault bool, a ...interface{})

TestLog is used to print log lines during testing only

func ToggleDecoration

func ToggleDecoration()

func Warn

func Warn(v ...any)

Types

type BarOptions

type BarOptions struct {
	Enabled     bool    // enable progress bar
	Type        BarType // if Expanding, the bar doesn't know how many object there will be, so grows
	Prefix      string  // the string to display first
	Fill        string  // the fill value for progress bar
	Start       int64   // the starting value (defaults to zero)
	Total       int64   // the total (possibly estimated for Expanding) number of objects
	PrefixColor string  // the color of the prefix
}

type BarType

type BarType int
const (
	Fixed BarType = iota
	Expanding
)

type ProgressBar

type ProgressBar struct {
	BarOptions
	// contains filtered or unexported fields
}

func NewBar

func NewBar(opts BarOptions) (bar *ProgressBar)

func (*ProgressBar) Bump

func (bar *ProgressBar) Bump()

func (*ProgressBar) Finish

func (bar *ProgressBar) Finish(newLine bool) time.Duration

func (*ProgressBar) Tick

func (bar *ProgressBar) Tick()

type Timer

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

func NewTimer

func NewTimer() Timer

func (*Timer) Level

func (t *Timer) Level(l int)

func (*Timer) LevelDown

func (t *Timer) LevelDown()

func (*Timer) LevelUp

func (t *Timer) LevelUp()

func (*Timer) Report

func (t *Timer) Report(msg string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳