tracer

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: GPL-3.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTraceId added in v0.0.16

func GetTraceId() (traceId string)

func NewTracer

func NewTracer() (gone.Goner, gone.GonerId)

func Priest

func Priest(cemetery gone.Cemetery) error

func SetTraceId added in v0.0.16

func SetTraceId(traceId string, cb func(), log ...func(format string, args ...any))

Types

type Tracer

type Tracer interface {

	//SetTraceId 设置TraceId;给调用函数设置一个`traceId`,如果traceId为空字符串,将生成自动一个
	SetTraceId(traceId string, fn func())

	//GetTraceId 获取当前协程的traceId
	GetTraceId() string

	//Go 开启一个新的协程,用于替代语法操作`go fn()`,在新的协程中将自动携带当前协程的`traceId`
	Go(fn func())

	//Recover 捕获 panic
	Recover()

	//RecoverSetTraceId SetTraceId 且 捕获 panic
	RecoverSetTraceId(traceId string, fn func())
}

Tracer 日志追踪,用于给同一个调用链路赋予统一的traceId,方便日志追踪

Jump to

Keyboard shortcuts

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