logging

package
v0.3.40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package logging contains logging related functions used by multiple packages

Index

Constants

View Source
const (
	Me       = 3
	MyCaller = 4
)

Variables

This section is empty.

Functions

func CallerStr

func CallerStr(skip uint) string

CallerStr returns the caller's function, source file and line number as a string

func GetFunctionAndSource

func GetFunctionAndSource(skip uint) (result []interface{})

GetFunctionAndSource gets function name and source line for logging

func GetGitRepoInfo

func GetGitRepoInfo(srcRepo *sourcev1.GitRepository) (result []interface{})

GetGitRepoInfo gets GitRepository details for logging

func GetLayer

func GetLayer(obj k8sruntime.Object) string

GetLayer gets layer, returning object name for AddonsLayer.kraan.io objects or owner name for others

func GetLayerInfo

func GetLayerInfo(src *kraanv1alpha1.AddonsLayer) (result []interface{})

GetLayerInfo gets AddonsLayer details 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

func GitRepoSourceKind

func GitRepoSourceKind() string

GitRepoSourceKind returns the gitrepository kind

func LayerKind

func LayerKind() string

LayerKind returns the AddonsLayer kind

func LogJSON

func LogJSON(data interface{}) string

LogJSON is used log an item in JSON format.

func TraceCall

func TraceCall(log logr.Logger)

Trace traces calls and exit for functions

func TraceExit

func TraceExit(log logr.Logger)

Trace traces calls and exit for functions

Types

type CallerInfo

type CallerInfo struct {
	FunctionName string
	SourceFile   string
	SourceLine   int
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL