Commit a92dd8f1 authored by Sebastian Stark's avatar Sebastian Stark

Use custom logger for Debugf since the default picks the wrong frame from call stack

parent 0192d0ea
......@@ -16,10 +16,11 @@ import (
)
var config *Config
var logger *log.Logger
func Debugf(format string, args ...interface{}) {
if os.Getenv("SNAPRD_DEBUG") == "1" {
log.Printf("<DEBUG> "+format, args...)
logger.Output(2, "<DEBUG> "+fmt.Sprintf(format, args...))
}
}
......@@ -184,7 +185,7 @@ func subcmdList() {
}
func main() {
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
logger = log.New(os.Stderr, "", log.Ldate | log.Ltime | log.Lshortfile)
config = LoadConfig()
if config == nil {
log.Fatal("no config, don't know what to do!")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment