print logs to stderr instead of stdout

also, don't print up-to-date status when the --silent flag was given

closes #68
This commit is contained in:
Andrey Nering
2017-09-30 14:56:35 -03:00
parent 14676dc3f8
commit abb19dfbf8
5 changed files with 29 additions and 21 deletions

26
log.go
View File

@@ -4,22 +4,28 @@ import (
"fmt"
)
func (e *Executor) println(args ...interface{}) {
fmt.Fprintln(e.Stdout, args...)
func (e *Executor) outf(s string, args ...interface{}) {
if len(args) == 0 {
s, args = "%s", []interface{}{s}
}
fmt.Fprintf(e.Stdout, s+"\n", args...)
}
func (e *Executor) printfln(format string, args ...interface{}) {
fmt.Fprintf(e.Stdout, format+"\n", args...)
}
func (e *Executor) verbosePrintln(args ...interface{}) {
func (e *Executor) verboseOutf(s string, args ...interface{}) {
if e.Verbose {
e.println(args...)
e.outf(s, args...)
}
}
func (e *Executor) verbosePrintfln(format string, args ...interface{}) {
func (e *Executor) errf(s string, args ...interface{}) {
if len(args) == 0 {
s, args = "%s", []interface{}{s}
}
fmt.Fprintf(e.Stderr, s+"\n", args...)
}
func (e *Executor) verboseErrf(s string, args ...interface{}) {
if e.Verbose {
e.printfln(format, args...)
e.errf(s, args...)
}
}