temp extended request logging #181

Merged
tech merged 1 commits from log-181 into main 2025-12-25 21:36:19 +00:00
2 changed files with 4 additions and 2 deletions

View File

@@ -346,7 +346,7 @@ func EstimateFee(ctx context.Context, deps driver.Deps, network shared.Network,
}
gasLimit, err := client.EstimateGas(timeoutCtx, callMsg)
if err != nil {
logger.Warn("Failed to estimate gas", zap.Error(err), zap.Error(err), zap.Any("call_message", callMsg))
logger.Warn("Failed to estimate gas", zap.Error(err), zap.Any("call_message", callMsg))
return nil, merrors.Internal("failed to estimate gas: " + err.Error())
}

View File

@@ -156,11 +156,12 @@ func (l *loggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, erro
fields := []zap.Field{
zap.String("network", l.network),
zap.String("rpc_endpoint", l.endpoint),
}
if len(reqBody) > 0 {
fields = append(fields, zap.String("rpc_request", truncate(string(reqBody), 2048)))
}
l.logger.Debug("RPC request", fields...)
l.logger.Error("RPC request", fields...)
resp, err := l.base.RoundTrip(req)
if err != nil {
@@ -181,6 +182,7 @@ func (l *loggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, erro
if len(bodyBytes) > 0 {
respFields = append(respFields, zap.String("rpc_response", truncate(string(bodyBytes), 2048)))
}
l.logger.Error("RPC response", respFields...)
if resp.StatusCode >= 400 {
l.logger.Warn("RPC response error", respFields...)
} else if len(bodyBytes) == 0 {