debug

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChooseColor

func ChooseColor(tag string) *color.Color256

ChooseColor will return the same color based on input string.

Types

type DebugLogger

type DebugLogger struct {
	Debugf LogFn
	Warnf  LogFn
	Infof  LogFn
	Errorf LogFn
	// contains filtered or unexported fields
}

DebugLogger is a container struct for the DebugLogger logger used to manage internal state. LogLevel is determined by log specifier coming after # character of DEBUG env var. e.g.) DEBUG=pm:cmd#i,d means prints pm:cmd logs with info & debug logs.

func NewDebugLogger

func NewDebugLogger(tag string) *DebugLogger

NewDebugLogger Returns a DebugLogger logging instance. It will determine if the logger should bypass logging actions or be activated. If NO_COLOR env var is set, color output is disabled.

func (*DebugLogger) Extend

func (k *DebugLogger) Extend(tag string) *DebugLogger

Extend returns a new DebugLogger logger instance that has appended the provided tag to the original logger.

New logger instance will have original `tag` value delimited with a `:` and appended with the new extended `tag` input.

Example:

k := New("test:original)
k.Log("test")
ke := k.Extend("plugin")
ke.Log("test extended")

Output:

test:original test
test:original:plugin test extended

func (*DebugLogger) Log

func (k *DebugLogger) Log(v ...interface{})

Log is an alias to Println

func (*DebugLogger) Printf

func (k *DebugLogger) Printf(format string, v ...interface{})

Printf is equivalent to fmt.Printf(f, pretty.Formatter(x), pretty.Formatter(y)).

func (*DebugLogger) Println

func (k *DebugLogger) Println(v ...interface{})

Println is equivalent to fmt.Println(pretty.Formatter(x), pretty.Formatter(y)), but each operand is formatted with "%# v".

type LogFn

type LogFn func(format string, v ...interface{})

Jump to

Keyboard shortcuts

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