Documentation
¶
Overview ¶
Package logging contains logging related functions used by multiple packages
Index ¶
- Constants
- Variables
- func CallerStr(skip uint) string
- func CallerText(skip uint) string
- func GetFunctionAndSource(skip uint) (result []interface{})
- func GetObjKindNamespaceName(obj k8sruntime.Object) (result []interface{})
- func GetObjNamespaceName(obj k8sruntime.Object) (result []interface{})
- func LogJSON(data interface{}) string
- func NewLogger(name string, logOpts *zap.Options) logr.Logger
- func TraceCall(log logr.Logger)
- func TraceExit(log logr.Logger)
- type CallerInfo
Constants ¶
const ( // Me is the setting for the function that called MyCaller. Me = 3 // MyCaller is the setting for the function that called the function calling MyCaller. MyCaller = 4 // MyCallersCaller is the setting for the function that called the function that called the function calling MyCaller. MyCallersCaller = 5 // MyCallersCallersCaller is the setting for the function that called the function that called the function that called the function calling MyCaller. MyCallersCallersCaller = 6 )
Variables ¶
var TraceLevel = four // nolint:gochecknoglobals //ok
Functions ¶
func CallerText ¶
CallerText generates a string containing caller function, source and line.
func GetFunctionAndSource ¶
func GetFunctionAndSource(skip uint) (result []interface{})
GetFunctionAndSource gets function name and source line for logging.
func GetObjKindNamespaceName ¶
func GetObjKindNamespaceName(obj k8sruntime.Object) (result []interface{})
GetObjKindNamespaceName gets object kind namespace and name for logging.
func GetObjNamespaceName ¶
func GetObjNamespaceName(obj k8sruntime.Object) (result []interface{})
GetObjNamespaceName gets object namespace and name for logging.
Types ¶
type CallerInfo ¶
CallerInfo hold the function name and source file/line from which a call was made.
func Callers ¶
func Callers(levels uint, short bool) ([]CallerInfo, error)
Callers returns an array of strings containing the function name, source filename and line number for the caller of this function and its caller moving up the stack for as many levels as are available or the number of levels specified by the levels parameter. Set the short parameter to true to only return final element of Function and source file name.
func GetCaller ¶
func GetCaller(skip uint, short bool) CallerInfo
GetCaller returns the caller of GetCaller 'skip' levels back. Set the short parameter to true to only return final element of Function and source file name.