Ophestra Umiker
ae1a102882
All checks were successful
test / test (push) Successful in 31s
Trying to print to a shared stdout is a terrible idea. This change makes it possible to withhold output for the lifetime of the sandbox. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
26 lines
321 B
Go
26 lines
321 B
Go
package fmsg
|
|
|
|
import "sync/atomic"
|
|
|
|
var verbose = new(atomic.Bool)
|
|
|
|
func Verbose() bool {
|
|
return verbose.Load()
|
|
}
|
|
|
|
func SetVerbose(v bool) {
|
|
verbose.Store(v)
|
|
}
|
|
|
|
func VPrintf(format string, v ...any) {
|
|
if verbose.Load() {
|
|
Printf(format, v...)
|
|
}
|
|
}
|
|
|
|
func VPrintln(v ...any) {
|
|
if verbose.Load() {
|
|
Println(v...)
|
|
}
|
|
}
|