From e1174bb67eff344e84dd2747145608fc196b987b Mon Sep 17 00:00:00 2001 From: Timothy Date: Fri, 6 Jun 2014 21:45:37 +0800 Subject: [PATCH] Output stack trace --- .gitignore | 4 +++- godns.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e58d451..4dc97fd 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,6 @@ _testmain.go *.exe *.test -config.json \ No newline at end of file +config.json +*.swp +godns diff --git a/godns.go b/godns.go index 541e2b1..ae16dfb 100644 --- a/godns.go +++ b/godns.go @@ -4,6 +4,7 @@ import ( "fmt" log "github.com/cihub/seelog" "os" + "runtime/debug" "strings" "time" ) @@ -39,6 +40,7 @@ func dns_loop(loop chan bool) { defer func() { if err := recover(); err != nil { log.Error(err) + log.Info("Stack trace:\n" + string(debug.Stack())) } }()