Skip to content

Commit 52c874a

Browse files
committed
common: Added debug reporter
NOTE: For known, non-consensus, hard to reproduce bugs consider the following method `common.Report("extra", stuff, "you need logged")` will give you a stack trace and a friendly request to submit it as an issue on our issue tracker.
1 parent eaf73b5 commit 52c874a

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎common/debug.go‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package common
2+
3+
import (
4+
"fmt"
5+
"os"
6+
"runtime"
7+
"runtime/debug"
8+
)
9+
10+
func Report(extra ...interface{}) {
11+
fmt.Fprintln(os.Stderr, "You've encountered a sought after, hard to reproduce bug. Please report this to the developers <3 https://github.com/ethereum/go-ethereum/issues")
12+
fmt.Fprintln(os.Stderr, extra...)
13+
14+
_, file, line, _ := runtime.Caller(1)
15+
fmt.Fprintf(os.Stderr, "%v:%v\n", file, line)
16+
17+
debug.PrintStack()
18+
19+
fmt.Fprintln(os.Stderr, "#### BUG! PLEASE REPORT ####")
20+
}

0 commit comments

Comments
 (0)