Documentation ¶
Overview ¶
Package callerinfo provides the GetCallerFunction to get the name of the module and function that has called you.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallerInfo ¶
type CallerInfo struct { Function string File string LineNum uint Module string ModuleVersion string }
CallerInfo holds basic information about a call site: Function is a long form module+function name that looks like: * main.main for your own main function * github.com/getoutreach/gobox/pkg/callerinfo.Test_Callers for a module function File is the file path of the call site LineNum is the line number inside that File of the call site Module is a best-effort attempt to get the module name for the call site (i.e. github.com/getoutreach/gobox) ModuleVersion will be the version of the Module used at the call site
func GetCallerInfo ¶
func GetCallerInfo(skipFrames uint16) (CallerInfo, error)
GetCallerInfo returns various types of info about the caller of the function. skipFrames determines how many frames above the caller to skip. If you want to know who is calling your function, you would pass in skipFrames of 1. skipFrames of 0 will return yourself.