add Sprintf and Sprintln

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-04 05:11:02 -06:00
parent 91b0564fb0
commit 52991d305f
2 changed files with 20 additions and 0 deletions

View File

@ -61,6 +61,18 @@ func Printf(s string, a ...any) {
realPrintf(s, a...)
}
func Sprintf(s string, a ...any) string {
if ! PRINTLN.Ok() { return ""}
if ! PRINTLN.b { return ""}
return realSprintf(s, a...)
}
func Sprintln(s string, a ...any) string {
if ! PRINTLN.Ok() { return ""}
if ! PRINTLN.b { return ""}
return realSprintln(s, a...)
}
func Fatalln(a ...any) {
realFatalln(a...)
}

View File

@ -36,6 +36,14 @@ func realPrintf(s string, a ...any) {
}
}
func realSprintf(s string, a ...any) string {
return fmt.Sprintf(s, a...)
}
func realSprintln(s string, a ...any) string {
return fmt.Sprintf(s, a...) + "\n"
}
func realFatalln(a ...any) {
reallog.Fatalln(a...)
}