MCPcopy
hub / github.com/sirupsen/logrus / getPackageName

Function getPackageName

entry.go:167–179  ·  view source on GitHub ↗

getPackageName reduces a fully qualified function name to the package name There really ought to be to be a better way...

(f string)

Source from the content-addressed store, hash-verified

165// getPackageName reduces a fully qualified function name to the package name
166// There really ought to be to be a better way...
167func getPackageName(f string) string {
168 for {
169 lastPeriod := strings.LastIndex(f, ".")
170 lastSlash := strings.LastIndex(f, "/")
171 if lastPeriod > lastSlash {
172 f = f[:lastPeriod]
173 } else {
174 break
175 }
176 }
177
178 return f
179}
180
181// getCaller retrieves the name of the first non-logrus calling function
182func getCaller() *runtime.Frame {

Callers 1

getCallerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected