Documentation ¶
Index ¶
- Constants
- Variables
- func GenSpanId() string
- func GenTraceId() (traceId string)
- func GetCptConfig(name string, conf interface{}) error
- func LoadCpt(cpt Cpt)
- func LoadCpts(instances ...Cpt)
- func LoadGlobalConfigFile(path string) error
- func SignalBindFunHandler(handler func(sig os.Signal), signals ...os.Signal)
- func SignalNotify()
- type Cpt
- type Trace
- type TraceContext
Constants ¶
View Source
const ( // 应用日志名称 AppLogName = "app" // 运行环境 DevEnv = "debug" ProEnv = "release" )
View Source
const ( // 链路追踪 CTX_TRACE = "trace" CTX_RESPONSE = "response" // 日志相关 TRACE_ID = "trace_id" SPAN_ID = "span_id" // 验证器 翻译器 CTX_VALIDATOR_KEY = "CtxValidatorKey" CTX_TRANSLATOR_KEY = "CtxTranslatorKey" )
链路追踪相关 Context 环境变量
Variables ¶
View Source
var FixZone = time.FixedZone("CST", 8*3600) //替换上海时区
有些电脑上面使用time.LoadLocation会失败,因为缺少一个文件,可以使用下面的方法替代
View Source
var LocalIP = net.ParseIP("127.0.0.1")
View Source
var RunEnv string // 运行环境
View Source
var SignalNotifyIsRuning = false
View Source
var TimeLocation *time.Location
View Source
var WorkDir string // 工作目录
Functions ¶
func SignalBindFunHandler ¶
绑定处理信号的函数
Types ¶
type TraceContext ¶
func NewTrace ¶
func NewTrace() *TraceContext
Click to show internal directories.
Click to hide internal directories.