log.go 435 B

123456789101112131415161718192021
  1. package fyne
  2. import (
  3. "log"
  4. "runtime"
  5. )
  6. // LogError reports an error to the command line with the specified err cause,
  7. // if not nil.
  8. // The function also reports basic information about the code location.
  9. func LogError(reason string, err error) {
  10. log.Println("Fyne error: ", reason)
  11. if err != nil {
  12. log.Println(" Cause:", err)
  13. }
  14. _, file, line, ok := runtime.Caller(1)
  15. if ok {
  16. log.Printf(" At: %s:%d", file, line)
  17. }
  18. }