From 2a3548508901b4f2455f11905f865bba2dfbe759 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Thu, 9 Feb 2017 20:55:13 +0000 Subject: [PATCH] Output full stacktrace for errors when debugging --- db/db.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/db/db.go b/db/db.go index c4f2317c..aff59ffc 100644 --- a/db/db.go +++ b/db/db.go @@ -20,6 +20,8 @@ import ( "net/http" + "runtime/debug" + "github.com/abcum/fibre" "github.com/abcum/surreal/cnf" "github.com/abcum/surreal/kvs" @@ -196,7 +198,8 @@ func (e *executor) execute(quit <-chan bool, send chan<- *Response) { defer func() { if r := recover(); r != nil { if err, ok := r.(error); ok { - fmt.Println(err) + log.WithPrefix("db").Errorln(err) + log.WithPrefix("db").Debugln(string(debug.Stack())) } } }()