()
| 562 | } |
| 563 | |
| 564 | func Trace() (r string, ss []string, full bool) { |
| 565 | bs := make([]byte, 16*1024) |
| 566 | if n := runtime.Stack(bs, false); n != len(bs) { |
| 567 | bs, full = bs[:n], true |
| 568 | } else { |
| 569 | bs = append(bs, []byte(" ...\n")...) |
| 570 | } |
| 571 | ss = strings.Split(string(bs), "\n") |
| 572 | for i := 0; i < len(ss); i++ { |
| 573 | ss[i] = strings.TrimSpace(ss[i]) |
| 574 | } |
| 575 | r, ss = ss[0], ss[1:] |
| 576 | return |
| 577 | } |
| 578 | |
| 579 | func Panic(format string, args ...interface{}) { |
| 580 | const tab = " " |