Ophestra Umiker
42e0b168e3
All checks were successful
test / test (push) Successful in 17s
The behaviour of print functions from package fmt is not thread safe. Functions provided by fmsg wrap around Logger methods. This makes prefix much cleaner and makes it easy to deal with future changes to logging. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
22 lines
275 B
Go
22 lines
275 B
Go
package fmsg
|
|
|
|
func Verbose() bool {
|
|
return verbose.Load()
|
|
}
|
|
|
|
func SetVerbose(v bool) {
|
|
verbose.Store(v)
|
|
}
|
|
|
|
func VPrintf(format string, v ...any) {
|
|
if verbose.Load() {
|
|
std.Printf(format, v...)
|
|
}
|
|
}
|
|
|
|
func VPrintln(v ...any) {
|
|
if verbose.Load() {
|
|
std.Println(v...)
|
|
}
|
|
}
|