mirror of
https://github.com/gopherdata/gophernotes.git
synced 2025-04-26 22:56:04 +00:00
33 lines
541 B
Go
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...)
|
|
}
|