zruntime

package
v0.0.0-alpha.16 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallerFrame

func CallerFrame(skip int) runtime.Frame

CallerFrame returns single caller frame. The argument skip is the number of stack frames to skip before recording frames, skip=0 means the caller frame and skip=1 means the caller of the caller. CallerFrame returns zero-value of runtime.Frame when there is no frames to report. See also runtime.Caller.

func CallerFrames

func CallerFrames(skip int) []runtime.Frame

CallerFrames returns a slice of caller frames. The argument skip is the number of stack frames to skip before recording frames, skip=0 means the caller frame and skip=1 means the caller of the caller. CallerFrames returns nil slice of runtime.Frame when there is no frames to report. CallerFrames returns 64 frames at maximum. See also runtime.CallersFrames.

func ReportErr

func ReportErr(err error, msg string)

ReportErr outputs the given error with stack trace to the os.Stderr. ReportErr does nothing if the given error is nil. Caller can pass additional error message. ReportErr should be used only for error that callers do not know how they handle if.

Types

type Frame

type Frame struct {
	// Pkg is go package name of the caller.
	Pkg string `json:"pkg" msgpack:"pkg" xml:"pkg" yaml:"pkg"`
	// File is the file name of the caller.
	File string `json:"file" msgpack:"file" xml:"file" yaml:"file"`
	// Func is the function name of the caller.
	Func string `json:"func" msgpack:"func" xml:"func" yaml:"func"`
	// Line is the line number of the caller.
	Line int `json:"line" msgpack:"line" xml:"line" yaml:"line"`
}

Frame holds stack frame information. See also runtime.Frame.

func ConvertFrame

func ConvertFrame(f runtime.Frame) Frame

ConvertFrame converts runtime.Frame into Frame. ConvertFrame returns zero value of Frame if the given frame is empty.

func ConvertFrames

func ConvertFrames(fs []runtime.Frame) []Frame

ConvertFrames converts a slice of runtime.Frame into a slice of Frame. ConvertFrames returns nil slice if the given slice is empty.

Directories

Path Synopsis
zdebug provides additional features of standard runtime/debug package.
zdebug provides additional features of standard runtime/debug package.

Jump to

Keyboard shortcuts

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