dbglog

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const LogValid bool = false //nolint:gochecknoglobals //i know that

LogValid shows dbglog.Log is enabled or abandoned

View Source
const MoreMapLog = false

MoreMapLog shows the buildtag 'moremaplog' is enabled or not.

This flag is used for hedzr/evendeep package so that it can print more debug logging messages when copying map struct.

You may borrow the mechanism to dump the more verbose messages for debugging purpose.

Variables

This section is empty.

Functions

func ChildLogEnabled

func ChildLogEnabled() bool

func Colored

func Colored(clr color.Color, format string, args ...interface{})

func DeferVisit

func DeferVisit(ec errors.Error, err *error)

DeferVisit moves errors in container ec, and log its via dbglog.Log

func DisableLogAndDefer added in v1.0.0

func DisableLogAndDefer() func()

DisableLogAndDefer can be used to disable dbglog.Log at runtime.

It detects and prevent log output if buildtag 'moremaplog' present.

To query the active state by calling ChildLogEnabled.

The best practice for DisableLogAndDefer is:

defer dbglog.DisableLogAndDefer()()
evendeep.CopyTo(...) // the verbose logging will be prevent even if buildtag 'verbose' defined.

func Err

func Err(format string, args ...interface{})

func Log

func Log(format string, args ...interface{})

Log will print formatted message while build-tags `delve` or `verbose` present.

The flag dbglog.LogValid identify that state.

func SetLogDisabled

func SetLogDisabled()

func SetLogEnabled

func SetLogEnabled()

func Wrn

func Wrn(format string, args ...interface{})

Types

type LogCapturer

type LogCapturer interface {
	Release()
}

LogCapturer reroutes testing.T log output

func CaptureLog

func CaptureLog(tb testing.TB) LogCapturer

CaptureLog redirects logrus output to testing.Log

func NewCaptureLog

func NewCaptureLog(tb testing.TB) LogCapturer

NewCaptureLog redirects logrus output to testing.Log

Jump to

Keyboard shortcuts

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