Skip to content

Commit

Permalink
Put tracing under the Conditional("VERBOSE")
Browse files Browse the repository at this point in the history
They allocate too much strings for each command, sent and processed, and useful for debugging the client only.
  • Loading branch information
odinserj committed Oct 16, 2024
1 parent 3d48db1 commit 30f76a9
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1147,11 +1147,13 @@ public IServer GetServer(EndPoint endpoint, object asyncState = null)
return new RedisServer(this, server, asyncState);
}

[Conditional("VERBOSE")]
internal void Trace(string message, [System.Runtime.CompilerServices.CallerMemberName] string category = null)
{
OnTrace(message, category);
}

[Conditional("VERBOSE")]
internal void Trace(bool condition, string message, [System.Runtime.CompilerServices.CallerMemberName] string category = null)
{
if (condition) OnTrace(message, category);
Expand Down Expand Up @@ -1205,16 +1207,19 @@ private static void OnTraceWithoutContext(string message, string category, Excep
}
}

[Conditional("VERBOSE")]
internal static void TraceExceptionWithoutContext(Exception exception, string message = null, [System.Runtime.CompilerServices.CallerMemberName] string category = null)
{
OnTraceWithoutContext(message + (exception?.Message ?? "(no exception)"), category, exception);
}

[Conditional("VERBOSE")]
internal static void TraceWithoutContext(string message, [System.Runtime.CompilerServices.CallerMemberName] string category = null)
{
OnTraceWithoutContext(message, category, null);
}

[Conditional("VERBOSE")]
internal static void TraceWithoutContext(bool condition, string message, [System.Runtime.CompilerServices.CallerMemberName] string category = null)
{
if(condition) OnTraceWithoutContext(message, category, null);
Expand Down

0 comments on commit 30f76a9

Please sign in to comment.