MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / logrusFrame

Function logrusFrame

internal/logging/logrus.go:98–114  ·  view source on GitHub ↗

logrusFrame adds the file and func to the logrus.Entry, for use in logging errors

(entry *logrus.Entry, frame runtime.Frame, module string)

Source from the content-addressed store, hash-verified

96// logrusFrame adds the file and func to the logrus.Entry,
97// for use in logging errors
98func logrusFrame(entry *logrus.Entry, frame runtime.Frame, module string) {
99 if frame.File != "" {
100 filename := strings.TrimPrefix(frame.File, module)
101 fileline := fmt.Sprintf("%s:%d", filename, frame.Line)
102 if v, ok := entry.Data["file"]; ok {
103 entry.Data["fields.file"] = v
104 }
105 entry.Data["file"] = fileline
106 }
107 if frame.Function != "" {
108 _, function := filepath.Split(frame.Function)
109 if v, ok := entry.Data["func"]; ok {
110 entry.Data["fields.func"] = v
111 }
112 entry.Data["func"] = function
113 }
114}

Callers 1

LogrusFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected