|
|
|
@ -6,6 +6,7 @@ import (
|
|
|
|
|
"github.com/dtapps/go-library/utils/dorm"
|
|
|
|
|
"github.com/dtapps/go-library/utils/goip"
|
|
|
|
|
"github.com/dtapps/go-library/utils/gorequest"
|
|
|
|
|
"github.com/dtapps/go-library/utils/gostring"
|
|
|
|
|
"github.com/dtapps/go-library/utils/gotime"
|
|
|
|
|
"github.com/dtapps/go-library/utils/gotrace_id"
|
|
|
|
|
"github.com/dtapps/go-library/utils/gourl"
|
|
|
|
@ -141,11 +142,11 @@ func (zl *ApiZapLog) Middleware(ctx context.Context, request gorequest.Response)
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "request_params",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
|
Interface: request.RequestParams, //
|
|
|
|
|
String: gostring.ToString(request.RequestParams), //
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "request_header",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
|
Interface: request.RequestHeader, //
|
|
|
|
|
String: gostring.ToString(request.RequestHeader), //
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "request_ip",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
@ -153,7 +154,7 @@ func (zl *ApiZapLog) Middleware(ctx context.Context, request gorequest.Response)
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "response_header",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
|
Interface: request.ResponseHeader, //
|
|
|
|
|
String: gostring.ToString(request.ResponseHeader), //
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "response_status_code",
|
|
|
|
|
Type: zapcore.Int64Type,
|
|
|
|
@ -161,7 +162,7 @@ func (zl *ApiZapLog) Middleware(ctx context.Context, request gorequest.Response)
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "response_body",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
|
Interface: dorm.JsonDecodeNoError(request.ResponseBody), //
|
|
|
|
|
String: gostring.ToString(dorm.JsonDecodeNoError(request.ResponseBody)), //
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "response_content_length",
|
|
|
|
|
Type: zapcore.Int64Type,
|
|
|
|
@ -228,11 +229,11 @@ func (zl *ApiZapLog) MiddlewareXml(ctx context.Context, request gorequest.Respon
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "request_params",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
|
Interface: request.RequestParams, //
|
|
|
|
|
String: gostring.ToString(request.RequestParams), //
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "request_header",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
|
Interface: request.RequestHeader, //
|
|
|
|
|
String: gostring.ToString(request.RequestHeader), //
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "request_ip",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
@ -240,7 +241,7 @@ func (zl *ApiZapLog) MiddlewareXml(ctx context.Context, request gorequest.Respon
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "response_header",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
|
Interface: request.ResponseHeader, //
|
|
|
|
|
String: gostring.ToString(request.ResponseHeader), //
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "response_status_code",
|
|
|
|
|
Type: zapcore.Int64Type,
|
|
|
|
@ -248,7 +249,7 @@ func (zl *ApiZapLog) MiddlewareXml(ctx context.Context, request gorequest.Respon
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "response_body",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
|
Interface: dorm.XmlDecodeNoError(request.ResponseBody), //
|
|
|
|
|
String: gostring.ToString(dorm.XmlDecodeNoError(request.ResponseBody)), //
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "response_content_length",
|
|
|
|
|
Type: zapcore.Int64Type,
|
|
|
|
@ -315,11 +316,11 @@ func (zl *ApiZapLog) MiddlewareCustom(ctx context.Context, api string, request g
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "request_params",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
|
Interface: request.RequestParams, //
|
|
|
|
|
String: gostring.ToString(request.RequestParams), //
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "request_header",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
|
Interface: request.RequestHeader, //
|
|
|
|
|
String: gostring.ToString(request.RequestHeader), //
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "request_ip",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
@ -327,7 +328,7 @@ func (zl *ApiZapLog) MiddlewareCustom(ctx context.Context, api string, request g
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "response_header",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
|
Interface: request.ResponseHeader, //
|
|
|
|
|
String: gostring.ToString(request.ResponseHeader), //
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "response_status_code",
|
|
|
|
|
Type: zapcore.Int64Type,
|
|
|
|
@ -335,7 +336,7 @@ func (zl *ApiZapLog) MiddlewareCustom(ctx context.Context, api string, request g
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "response_body",
|
|
|
|
|
Type: zapcore.StringType,
|
|
|
|
|
Interface: dorm.JsonDecodeNoError(request.ResponseBody), //
|
|
|
|
|
String: gostring.ToString(dorm.JsonDecodeNoError(request.ResponseBody)), //
|
|
|
|
|
}, zapcore.Field{
|
|
|
|
|
Key: "response_content_length",
|
|
|
|
|
Type: zapcore.Int64Type,
|
|
|
|
|