MCPcopy Create free account
hub / github.com/kataras/iris / HandlerName

Function HandlerName

context/handler.go:145–162  ·  view source on GitHub ↗

HandlerName returns the handler's function name. See `Context.HandlerName` method to get function name of the current running handler in the chain. See `SetHandlerName` too.

(h interface{})

Source from the content-addressed store, hash-verified

143// See `Context.HandlerName` method to get function name of the current running handler in the chain.
144// See `SetHandlerName` too.
145func HandlerName(h interface{}) string {
146 pc := valueOf(h).Pointer()
147 fn := runtime.FuncForPC(pc)
148 name := fn.Name()
149 filename, _ := fn.FileLine(fn.Entry())
150 filenameLower := strings.ToLower(filename)
151
152 handlerNamesMu.RLock()
153 for expr, newName := range handlerNames {
154 if expr.MatchString(name) || expr.MatchFilename(filenameLower) {
155 name = newName
156 break
157 }
158 }
159 handlerNamesMu.RUnlock()
160
161 return trimHandlerName(name)
162}
163
164// HandlersNames returns a slice of "handlers" names
165// separated by commas. Can be used for debugging

Callers 12

getBindingsForFuncFunction · 0.92
makeHandlerFunction · 0.92
CountHandlersMethod · 0.92
RemoveHandlerMethod · 0.92
RemoveHandlerMethod · 0.92
removeHandlerFunction · 0.92
TraceMethod · 0.92
HandlersNamesFunction · 0.85
MainHandlerNameFunction · 0.85
UpsertHandlersFunction · 0.85
HandlerExistsFunction · 0.85
HandlerNameMethod · 0.85

Calls 5

trimHandlerNameFunction · 0.85
MatchStringMethod · 0.80
MatchFilenameMethod · 0.80
valueOfFunction · 0.70
NameMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…