getPackageName reduces a fully qualified function name to the package name There really ought to be to be a better way...
(f string)
| 165 | // getPackageName reduces a fully qualified function name to the package name |
| 166 | // There really ought to be to be a better way... |
| 167 | func 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 |
| 182 | func getCaller() *runtime.Frame { |