zlog

package
v0.0.0-...-0521b85 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause Imports: 14 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PrintPriority = DebugLevel

	UseColor        = false
	PanicHandler    func(reason string, exit bool)
	PrintGoRoutines = false
	PrintDate       = true

	EnablerList zmap.LockMap[string, *Enabler]
)
View Source
var SyslogName string

Functions

func AddHook

func AddHook(id string, call func(s string))

func Assert

func Assert(success bool, parts ...any)

func AssertMakeError

func AssertMakeError(success bool, parts ...any) error

func AssertNotError

func AssertNotError(err error, parts ...any)

func CallingFunctionInfo

func CallingFunctionInfo(pos int) (function, file string, line int)

func CallingFunctionString

func CallingFunctionString(pos int) string

func CallingStackString

func CallingStackString() string

func CallingStackStringAt

func CallingStackStringAt(index int) string

func Debug

func Debug(parts ...any)

Debug performs Log with DebugLevel priority

func Error

func Error(parts ...any) error

func ErrorAtStack

func ErrorAtStack(stackPos int, parts ...any) error

Error performs Log with ErrorLevel priority, getting stack from N

func ErrorIf

func ErrorIf(check bool, parts ...any) bool

func Fatal

func Fatal(parts ...any) error

Fatal performs Log with Fatal priority

func FatalNotImplemented

func FatalNotImplemented()

func FileLineAndCallingFunctionString

func FileLineAndCallingFunctionString(pos int) string

func Full

func Full(v any) string

func Func

func Func()

func HandlePanic

func HandlePanic(exit bool) error

func Hex

func Hex(v any) string

func Info

func Info(parts ...any)

Info performs Log with InfoLevel priority

func Infof

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

Info performs Log with InfoLevel priority

func NewError

func NewError(parts ...any) error

func OnError

func OnError(err error, parts ...any) bool

func OnErrorTestError

func OnErrorTestError(t *testing.T, err error, items ...any) bool

func Pointer

func Pointer(v any) string

func PrintStartupInfo

func PrintStartupInfo(version, commitHash, builtAt, builtBy, builtOn string)

func RegisterEnabler

func RegisterEnabler(name string, b *Enabler)

func Verbose

func Verbose(parts ...any)

Verbose performs Log with InfoLevel priority

func Warn

func Warn(parts ...any)

Info performs Log with InfoLevel priority

func Wrap

func Wrap(err error, parts ...any) error

Types

type Enabler

type Enabler bool

type LimitID

type LimitID string

func Limit

func Limit(parts ...any) LimitID

type Line

type Line struct {
	Text     string
	Duration time.Duration
	Time     time.Time
}

type Priority

type Priority int
const (
	VerboseLevel Priority = iota
	DebugLevel
	InfoLevel
	WarningLevel
	ErrorLevel
	FatalLevel
)

type Profile

type Profile struct {
	Name    string
	Start   time.Time
	Lines   []Line
	MinSecs float64
}

func NewProfile

func NewProfile(minSecs float64, name ...any) Profile

func (*Profile) End

func (p *Profile) End(parts ...any)

func (*Profile) Log

func (p *Profile) Log(parts ...any)

type StackAdjust

type StackAdjust int

type WrappedError

type WrappedError struct {
	Text  string
	Error error
}

func (*WrappedError) Unwrap

func (w *WrappedError) Unwrap() error

Jump to

Keyboard shortcuts

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