context_util

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOG_CONTEXT_PREFIX = "logcontext-"
	REQUEST_IP         = LOG_CONTEXT_PREFIX + "requestip" // 全局变量
	REQUEST_ID         = LOG_CONTEXT_PREFIX + "requestid" // 全局变量
	USER_ID            = LOG_CONTEXT_PREFIX + "userid"    // 全局变量
	SESSION_ID         = LOG_CONTEXT_PREFIX + "sessionid" // 当前服务变量
	APP_ID             = LOG_CONTEXT_PREFIX + "appid"     // 当前服务变量
	ENV_TYPE           = LOG_CONTEXT_PREFIX + "envtype"   // 当前服务变量
)

Variables

This section is empty.

Functions

func SetLogContextToNewRequst

func SetLogContextToNewRequst(request *http.Request)

将需要贯穿整个调用链的日志字段穿到下一个请求

func SetMdcFromHeaderMiddleware

func SetMdcFromHeaderMiddleware(c *gin.Context)

将请求header中的日志字段设置到MDC

Types

This section is empty.

Jump to

Keyboard shortcuts

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