MCPcopy Create free account
hub / github.com/ZeppelinMC/Zeppelin / stackCallerModule

Function stackCallerModule

util/log/log.go:103–136  ·  view source on GitHub ↗
(i int)

Source from the content-addressed store, hash-verified

101}
102
103func stackCallerModule(i int) string {
104 buf := stackBuf.Get().([]byte)
105 defer stackBuf.Put(buf)
106
107 buf = buf[:runtime.Stack(buf, false)]
108 str := unsafe.String(unsafe.SliceData(buf), len(buf))
109
110 lines := strings.Split(str, "\n")[1:]
111
112 i = int(math.RoundToEven(float64(i))) + 1
113 line := lines[i]
114
115 sp := strings.Split(line, "/")
116 if len(sp) == 0 {
117 return ""
118 }
119 i = strings.Index(sp[len(sp)-1], ".")
120 if i != -1 {
121 sp[len(sp)-1] = sp[len(sp)-1][:i]
122 }
123
124 if i := strings.Index(sp[0], "."); i != -1 {
125 sp = sp[2:]
126 }
127
128 modName := sp[0]
129 pkgName := sp[len(sp)-1]
130
131 if modName == "main" {
132 modName = mainModuleName
133 }
134
135 return modName + "::" + pkgName
136}
137
138/*
139Println prints the content prefixed and suffixed with a carriage return with an endline in the end.

Callers 15

ChatFunction · 0.85
InfolnFunction · 0.85
InfolnCleanFunction · 0.85
InfolnfCleanFunction · 0.85
InfoFunction · 0.85
InfofFunction · 0.85
InfolnfFunction · 0.85
ErrorlnFunction · 0.85
ErrorlnCleanFunction · 0.85
ErrorFunction · 0.85
ErrorfFunction · 0.85
ErrorlnfFunction · 0.85

Calls 2

GetMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected