github.com/neatlab/neatio@v1.7.3-0.20220425043230-d903e92fcc75/utilities/common/debug.go (about)

     1  package common
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  	"runtime"
     7  	"runtime/debug"
     8  	"strings"
     9  )
    10  
    11  func Report(extra ...interface{}) {
    12  	fmt.Fprintln(os.Stderr, "You've encountered a sought after, hard to reproduce bug. Please report this to the developers <3 https://github.com/neatlab/neatio/issues")
    13  	fmt.Fprintln(os.Stderr, extra...)
    14  
    15  	_, file, line, _ := runtime.Caller(1)
    16  	fmt.Fprintf(os.Stderr, "%v:%v\n", file, line)
    17  
    18  	debug.PrintStack()
    19  
    20  	fmt.Fprintln(os.Stderr, "#### BUG! PLEASE REPORT ####")
    21  }
    22  
    23  func PrintDepricationWarning(str string) {
    24  	line := strings.Repeat("#", len(str)+4)
    25  	emptyLine := strings.Repeat(" ", len(str))
    26  	fmt.Printf(`
    27  %s
    28  # %s #
    29  # %s #
    30  # %s #
    31  %s
    32  
    33  `, line, emptyLine, str, emptyLine, line)
    34  }