v0.0.444 change gin values in exerr auto meta to not include dots in keys (fucks up mongo)
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 3m9s
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 3m9s
This commit is contained in:
parent
15a639f85a
commit
dcb5d3d7cd
@ -309,27 +309,27 @@ func (b *Builder) Errs(key string, val []error) *Builder {
|
|||||||
func (b *Builder) GinReq(ctx context.Context, g *gin.Context, req *http.Request) *Builder {
|
func (b *Builder) GinReq(ctx context.Context, g *gin.Context, req *http.Request) *Builder {
|
||||||
if v := ctx.Value("start_timestamp"); v != nil {
|
if v := ctx.Value("start_timestamp"); v != nil {
|
||||||
if t, ok := v.(time.Time); ok {
|
if t, ok := v.(time.Time); ok {
|
||||||
b.Time("ctx.startTimestamp", t)
|
b.Time("ctx_startTimestamp", t)
|
||||||
b.Time("ctx.endTimestamp", time.Now())
|
b.Time("ctx_endTimestamp", time.Now())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b.Str("gin.method", req.Method)
|
b.Str("gin_method", req.Method)
|
||||||
b.Str("gin.path", g.FullPath())
|
b.Str("gin_path", g.FullPath())
|
||||||
b.Strs("gin.header", extractHeader(g.Request.Header))
|
b.Strs("gin_header", extractHeader(g.Request.Header))
|
||||||
if req.URL != nil {
|
if req.URL != nil {
|
||||||
b.Str("gin.url", req.URL.String())
|
b.Str("gin_url", req.URL.String())
|
||||||
}
|
}
|
||||||
if ctxVal := g.GetString("apiversion"); ctxVal != "" {
|
if ctxVal := g.GetString("apiversion"); ctxVal != "" {
|
||||||
b.Str("gin.context.apiversion", ctxVal)
|
b.Str("gin_context_apiversion", ctxVal)
|
||||||
}
|
}
|
||||||
if ctxVal := g.GetString("uid"); ctxVal != "" {
|
if ctxVal := g.GetString("uid"); ctxVal != "" {
|
||||||
b.Str("gin.context.uid", ctxVal)
|
b.Str("gin_context_uid", ctxVal)
|
||||||
}
|
}
|
||||||
if ctxVal := g.GetString("fcmId"); ctxVal != "" {
|
if ctxVal := g.GetString("fcmId"); ctxVal != "" {
|
||||||
b.Str("gin.context.fcmid", ctxVal)
|
b.Str("gin_context_fcmid", ctxVal)
|
||||||
}
|
}
|
||||||
if ctxVal := g.GetString("reqid"); ctxVal != "" {
|
if ctxVal := g.GetString("reqid"); ctxVal != "" {
|
||||||
b.Str("gin.context.reqid", ctxVal)
|
b.Str("gin_context_reqid", ctxVal)
|
||||||
}
|
}
|
||||||
if req.Method != "GET" && req.Body != nil {
|
if req.Method != "GET" && req.Body != nil {
|
||||||
|
|
||||||
@ -340,12 +340,12 @@ func (b *Builder) GinReq(ctx context.Context, g *gin.Context, req *http.Request)
|
|||||||
var prettyJSON bytes.Buffer
|
var prettyJSON bytes.Buffer
|
||||||
err = json.Indent(&prettyJSON, bin, "", " ")
|
err = json.Indent(&prettyJSON, bin, "", " ")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
b.Str("gin.body", string(prettyJSON.Bytes()))
|
b.Str("gin_body", string(prettyJSON.Bytes()))
|
||||||
} else {
|
} else {
|
||||||
b.Bytes("gin.body", bin)
|
b.Bytes("gin_body", bin)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
b.Str("gin.body", fmt.Sprintf("[[%v bytes | %s]]", len(bin), req.Header.Get("Content-Type")))
|
b.Str("gin_body", fmt.Sprintf("[[%v bytes | %s]]", len(bin), req.Header.Get("Content-Type")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -355,9 +355,9 @@ func (b *Builder) GinReq(ctx context.Context, g *gin.Context, req *http.Request)
|
|||||||
if brc, ok := req.Body.(dataext.BufferedReadCloser); ok {
|
if brc, ok := req.Body.(dataext.BufferedReadCloser); ok {
|
||||||
if bin, err := brc.BufferedAll(); err == nil {
|
if bin, err := brc.BufferedAll(); err == nil {
|
||||||
if len(bin) < 16*1024 {
|
if len(bin) < 16*1024 {
|
||||||
b.Bytes("gin.body", bin)
|
b.Bytes("gin_body", bin)
|
||||||
} else {
|
} else {
|
||||||
b.Str("gin.body", fmt.Sprintf("[[%v bytes | %s]]", len(bin), req.Header.Get("Content-Type")))
|
b.Str("gin_body", fmt.Sprintf("[[%v bytes | %s]]", len(bin), req.Header.Get("Content-Type")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.443"
|
const GoextVersion = "0.0.444"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2024-05-03T11:56:29+0200"
|
const GoextVersionTimestamp = "2024-05-03T13:24:08+0200"
|
||||||
|
Loading…
Reference in New Issue
Block a user