Allow to set verbosity of output (Closes #26)

This commit is contained in:
2025-01-28 21:02:12 +01:00
parent 2bdcdcb1dd
commit cced4f04b2
14 changed files with 89 additions and 33 deletions

17
outputter/Printf.go Normal file
View File

@ -0,0 +1,17 @@
package outputter
import (
"fmt"
"log"
)
func (outputter *Outputter) Printf(format string, args ...any) {
switch outputter.OutputType {
case "short":
fmt.Printf(format, args...)
case "long":
log.Printf(format, args...)
case "silent":
// Do nothing
}
}

17
outputter/Println.go Normal file
View File

@ -0,0 +1,17 @@
package outputter
import (
"fmt"
"log"
)
func (outputter *Outputter) Println(msg ...any) {
switch outputter.OutputType {
case "short":
fmt.Println(msg...)
case "long":
log.Println(msg...)
case "silent":
// Do nothing
}
}

5
outputter/types.go Normal file
View File

@ -0,0 +1,5 @@
package outputter
type Outputter struct {
OutputType string
}