Documentation
¶
Index ¶
- Constants
- func SetLogger(l logx.Logger)
- type AccessLog
- type AccesslogCtl
- func (b *AccesslogCtl) AllowQuery() *AccesslogCtl
- func (b *AccesslogCtl) AllowReqBody() *AccesslogCtl
- func (b *AccesslogCtl) AllowRespBody() *AccesslogCtl
- func (b *AccesslogCtl) AllowStamp() *AccesslogCtl
- func (b *AccesslogCtl) AllowTrace() *AccesslogCtl
- func (b *AccesslogCtl) Build() gin.HandlerFunc
Constants ¶
View Source
const ( Auth = "Authorization" TraceIdName = "X-Request-Id" SpanIdName = "X-Request-Spanid" ParentSpanIdName = "X-Request-Parentspanid" GinKeyTraceName = "gotox-traceid" Plaform = "plaform" // 平台,web、android、ios、pc等 Token = "token" // token 字段,通常是 jwt token 或者其他的 token )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessLog ¶
type AccessLog struct {
// 链路追踪
TraceId string `json:"trace_id"`
SpanId string `json:"span_id"`
ParentSpanId string `json:"parent_span_id"`
Auth string `json:"authorization"`
// 业务特征
TimeStamp int64 `json:"time_stamp"`
Ip string `json:"ip"`
Sn string `json:"sn"`
Guid string `json:"guid"`
Plaform string `json:"plaform"` // 平台,web、android、ios、pc等
Token string `json:"token"`
// 业务信息
Method string `json:"method"`
Path string `json:"path"`
Query string `json:"query"`
ReqBody string `json:"req_body"`
Duration string `json:"duration"`
StatusCode int `json:"status_code"`
RespBody string `json:"resp_body"`
}
AccessLog 你可以打印很多的信息,根据需要自己加
type AccesslogCtl ¶
type AccesslogCtl struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func NewBuilder(fn func(ctx context.Context, al AccessLog)) *AccesslogCtl
fn 的 ctx 其实是 gin.Context
func (*AccesslogCtl) AllowQuery ¶
func (b *AccesslogCtl) AllowQuery() *AccesslogCtl
func (*AccesslogCtl) AllowReqBody ¶
func (b *AccesslogCtl) AllowReqBody() *AccesslogCtl
func (*AccesslogCtl) AllowRespBody ¶
func (b *AccesslogCtl) AllowRespBody() *AccesslogCtl
func (*AccesslogCtl) AllowStamp ¶
func (b *AccesslogCtl) AllowStamp() *AccesslogCtl
func (*AccesslogCtl) AllowTrace ¶
func (b *AccesslogCtl) AllowTrace() *AccesslogCtl
func (*AccesslogCtl) Build ¶
func (b *AccesslogCtl) Build() gin.HandlerFunc
Click to show internal directories.
Click to hide internal directories.