Allow to set verbosity of output (Closes #26)
This commit is contained in:
17
outputter/Printf.go
Normal file
17
outputter/Printf.go
Normal 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
17
outputter/Println.go
Normal 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
5
outputter/types.go
Normal file
@ -0,0 +1,5 @@
|
||||
package outputter
|
||||
|
||||
type Outputter struct {
|
||||
OutputType string
|
||||
}
|
Reference in New Issue
Block a user