X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fgithub.com%2Fbytom%2Fcommon%2Fdebug.go;fp=vendor%2Fgithub.com%2Fbytom%2Fcommon%2Fdebug.go;h=23735945dd24faa91bd11334781e7f9e097091ab;hb=ccc8361b42f427774c3af566fbab32bb14d33ef4;hp=0000000000000000000000000000000000000000;hpb=d769c89103ea2d03047c879039f7623623605897;p=bytom%2Fequity.git diff --git a/vendor/github.com/bytom/common/debug.go b/vendor/github.com/bytom/common/debug.go new file mode 100644 index 0000000..2373594 --- /dev/null +++ b/vendor/github.com/bytom/common/debug.go @@ -0,0 +1,36 @@ +package common + +import ( + "fmt" + "os" + "runtime" + "runtime/debug" + "strings" +) + +// Report gives off a warning requesting the user to submit an issue to the github tracker. +func Report(extra ...interface{}) { + 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") + fmt.Fprintln(os.Stderr, extra...) + + _, file, line, _ := runtime.Caller(1) + fmt.Fprintf(os.Stderr, "%v:%v\n", file, line) + + debug.PrintStack() + + fmt.Fprintln(os.Stderr, "#### BUG! PLEASE REPORT ####") +} + +// PrintDepricationWarning prinst the given string in a box using fmt.Println. +func PrintDepricationWarning(str string) { + line := strings.Repeat("#", len(str)+4) + emptyLine := strings.Repeat(" ", len(str)) + fmt.Printf(` +%s +# %s # +# %s # +# %s # +%s + +`, line, emptyLine, str, emptyLine, line) +}