Documentation
¶
Overview ¶
Package caller get information regarding caller stack.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetCallerFunctionName ¶
func GetCallerFunctionName() string
GetCallerFunctionName return the name of whom called this function
Types ¶
type CallerInfo ¶
CallerInfo holds information regarding a given caller frame
func GetCallerInfo ¶
func GetCallerInfo(callerSkipFrames int) (CallerInfo, error)
GetCallerInfo returns a struct of CallerInfo regarding the caller frame requested by callerSkipFrames.
With callerSkipFrames, when value is 0 - It will return runtime.Callers, When callerSkipFrames is 1, it will return GetCallerInfo. So it is recommended to set callerSkipFrames for 2 or beyond to get the current caller for information.
func GetCallerStack ¶
func GetCallerStack(callerSkipFrames, maxStack int) ([]CallerInfo, error)
GetCallerStack provides a list of all stack level (from callerSkipFrames and up to most of maxStack or the latest element that was read).
With callerSkipFrames, when value is 0 - It will return runtime.Callers, When callerSkipFrames is 1, it will return GetCallerInfo. So it is recommended to set callerSkipFrames for 2 or beyond to get the current caller for information.
maxStack must be bigger than 0 or an error will be returned.
func (CallerInfo) DebugInfo ¶
func (ci CallerInfo) DebugInfo() string
DebugInfo provides string with verbose information of each field
func (CallerInfo) FileName ¶
func (ci CallerInfo) FileName() string
FileName returns only the file name without the rest of the path.
func (CallerInfo) PackageName ¶
func (ci CallerInfo) PackageName() string
PackageName returns only the Package name and ignoring the rest of the path.
func (CallerInfo) String ¶
func (ci CallerInfo) String() string