Files
asciinema/util/echo.go

27 lines
534 B
Go
Raw Permalink Normal View History

2014-08-02 22:29:02 +02:00
package util
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{}) {
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{}) {
fmt.Fprintf(loggerOutput, "\x1b[33m~ %v\x1b[0m\n", fmt.Sprintf(s, args...))
2014-08-02 22:29:02 +02:00
}