Source File
debug.go
Belonging Package
go101.org/nstd
package nstd
import (
)
var debugLogger = log.New(os.Stderr, "[debug]: ", 0)
// Debug calls [log.Print] and returns true,
// so that it can be used in
//
// _ = DebugMode && nstd.Debug(...)
func ( ...any) bool {
debugLogger.Print(...)
return true
}
// Debugf calls [log.Printf] and return true,
// so that it can be used in
//
// _ = DebugMode && nstd.Debugf(...)
func ( string, ...any) bool {
debugLogger.Printf(, ...)
return true
}
// assert is used interanlly
func assert( bool, string, ...any) bool {
if ! {
if len() == 0 {
debugLogger.Print()
} else {
debugLogger.Printf(, ...)
}
panic("Assert fails")
}
return true
}
The pages are generated with Golds v0.7.3. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |