MCPcopy
hub / github.com/CodisLabs/codis / StringWithIndent

Method StringWithIndent

pkg/utils/trace/trace.go:40–60  ·  view source on GitHub ↗
(indent int)

Source from the content-addressed store, hash-verified

38}
39
40func (s Stack) StringWithIndent(indent int) string {
41 var b bytes.Buffer
42 for i, r := range s {
43 for j := 0; j < indent; j++ {
44 fmt.Fprint(&b, tab)
45 }
46 fmt.Fprintf(&b, "%-3d %s:%d\n", len(s)-i-1, r.File, r.Line)
47 for j := 0; j < indent; j++ {
48 fmt.Fprint(&b, tab)
49 }
50 fmt.Fprint(&b, tab, tab)
51 fmt.Fprint(&b, r.Name, "\n")
52 }
53 if len(s) != 0 {
54 for j := 0; j < indent; j++ {
55 fmt.Fprint(&b, tab)
56 }
57 fmt.Fprint(&b, tab, "... ...\n")
58 }
59 return b.String()
60}
61
62func TraceN(skip, depth int) Stack {
63 s := make([]*Record, 0, depth)

Callers 2

outputMethod · 0.95
StringMethod · 0.95

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected