2016-01-23 13:48:33 -06:00

33 lines
541 B
Go

package replpkg
import (
"fmt"
"os"
"path/filepath"
"runtime"
)
var debug bool
func debugf(format string, args ...interface{}) {
if !debug {
return
}
_, file, line, ok := runtime.Caller(1)
if ok {
format = fmt.Sprintf("%s:%d %s", filepath.Base(file), line, format)
}
fmt.Fprintf(os.Stderr, format+"\n", args...)
}
func errorf(format string, args ...interface{}) {
fmt.Fprintf(os.Stderr, "error: "+format+"\n", args...)
}
func infof(format string, args ...interface{}) {
fmt.Fprintf(os.Stderr, format+"\n", args...)
}