Documentation ¶
Index ¶
- Constants
- func ChildLogEnabled() bool
- func Colored(clr color.Color, format string, args ...interface{})
- func DeferVisit(ec errors.Error, err *error)
- func DisableLogAndDefer() func()
- func Err(format string, args ...interface{})
- func Log(format string, args ...interface{})
- func SetLogDisabled()
- func SetLogEnabled()
- func Wrn(format string, args ...interface{})
- type LogCapturer
Constants ¶
const LogValid bool = false //nolint:gochecknoglobals //i know that
LogValid shows dbglog.Log is enabled or abandoned
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 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 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()
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