修改日志驱动类型
This commit is contained in:
@@ -25,7 +25,7 @@ type Request struct {
|
|||||||
port uint16
|
port uint16
|
||||||
rootCertPath string
|
rootCertPath string
|
||||||
client *http.Client
|
client *http.Client
|
||||||
logger *zap.Logger
|
logger *zap.SugaredLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送请求
|
// 发送请求
|
||||||
@@ -61,10 +61,10 @@ func (r *Request) Send(methodName string, body any, responseBody any) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if r.logger != nil {
|
if r.logger != nil {
|
||||||
r.logger.Debug("request: ",
|
r.logger.Infof("method: %s, request: %s, response: %s",
|
||||||
zap.String("method", methodName),
|
methodName,
|
||||||
zap.String("request", string(bodyByte)),
|
string(bodyByte),
|
||||||
zap.String("response", string(responseBodyByte)),
|
string(responseBodyByte),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ func (r *Request) Send(methodName string, body any, responseBody any) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
func Initiate(host string, port uint16, rootCertPath string, logger *zap.Logger) error {
|
func Initiate(host string, port uint16, rootCertPath string, logger *zap.SugaredLogger) error {
|
||||||
rootCert, err := os.ReadFile(rootCertPath)
|
rootCert, err := os.ReadFile(rootCertPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cert file read fail")
|
return fmt.Errorf("cert file read fail")
|
||||||
|
|||||||
Reference in New Issue
Block a user