From 90b2d6f53ec365de558abf9b71e6c5e2c1714571 Mon Sep 17 00:00:00 2001 From: Ryan Gang Date: Tue, 28 May 2024 10:41:14 +0530 Subject: [PATCH] feat: update "received RESP value" log to print data types too --- .../instrumented_resp_connection.go | 4 +++- internal/resp/value/value.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/instrumented_resp_connection/instrumented_resp_connection.go b/internal/instrumented_resp_connection/instrumented_resp_connection.go index 05f06cc..14b0c4f 100644 --- a/internal/instrumented_resp_connection/instrumented_resp_connection.go +++ b/internal/instrumented_resp_connection/instrumented_resp_connection.go @@ -28,7 +28,9 @@ func defaultCallbacks(stageHarness *test_case_harness.TestCaseHarness, logPrefix stageHarness.Logger.Debugf("%sReceived bytes: %q", logPrefix, string(bytes)) }, AfterReadValue: func(value resp_value.Value) { - stageHarness.Logger.Debugf("%sReceived RESP value: %s", logPrefix, value.FormattedString()) + valueTypeLowerCase := strings.ReplaceAll(strings.ToLower(value.Type), "_", " ") + stageHarness.Logger.Debugf("%sReceived RESP %s: %s", logPrefix, valueTypeLowerCase, value.FormattedString()) + }, } } diff --git a/internal/resp/value/value.go b/internal/resp/value/value.go index 53085de..c76e216 100644 --- a/internal/resp/value/value.go +++ b/internal/resp/value/value.go @@ -113,7 +113,7 @@ func (v *Value) FormattedString() string { case ERROR: return fmt.Sprintf("%q", "ERR: "+v.String()) case NIL: - return "NIL" + return "$-1\\r\\n" } return ""