verbose: overridable prefix

Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
Ophestra Umiker 2024-10-11 01:49:11 +09:00
parent 101e49a48b
commit 6eb712aec7
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q
1 changed files with 6 additions and 4 deletions

View File

@ -1,17 +1,19 @@
package verbose
import "fmt"
import (
"fmt"
)
const prefix = "fortify:"
var Prefix = "fortify:"
func Println(a ...any) {
if verbose.Load() {
fmt.Println(append([]any{prefix}, a...)...)
fmt.Println(append([]any{Prefix}, a...)...)
}
}
func Printf(format string, a ...any) {
if verbose.Load() {
fmt.Printf(prefix+" "+format, a...)
fmt.Printf(Prefix+" "+format, a...)
}
}