2014-08-02 22:29:02 +02:00
|
|
|
package util
|
|
|
|
|
|
2015-08-08 21:28:41 +02:00
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"io"
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
"os"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var loggerOutput io.Writer = os.Stdout
|
|
|
|
|
|
|
|
|
|
func BeQuiet() {
|
|
|
|
|
loggerOutput = ioutil.Discard
|
|
|
|
|
}
|
2014-08-02 22:29:02 +02:00
|
|
|
|
|
|
|
|
func Printf(s string, args ...interface{}) {
|
2015-08-08 21:28:41 +02:00
|
|
|
fmt.Fprintf(loggerOutput, "\x1b[32m~ %v\x1b[0m\n", fmt.Sprintf(s, args...))
|
2014-08-02 22:29:02 +02:00
|
|
|
}
|
|
|
|
|
|
2016-02-03 22:49:49 -08:00
|
|
|
func ReplaceWarningf(s string, args ...interface{}) {
|
|
|
|
|
fmt.Fprintf(loggerOutput, "\r\x1b[33m~ %v\x1b[0m", fmt.Sprintf(s, args...))
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-02 22:29:02 +02:00
|
|
|
func Warningf(s string, args ...interface{}) {
|
2015-08-08 21:28:41 +02:00
|
|
|
fmt.Fprintf(loggerOutput, "\x1b[33m~ %v\x1b[0m\n", fmt.Sprintf(s, args...))
|
2014-08-02 22:29:02 +02:00
|
|
|
}
|