Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit d445ff1

Browse files
committed
Check Log.IsDebugEnabled for Debug logs
1 parent 446a083 commit d445ff1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/ServiceStack.Redis/RedisPubSubServer.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,13 @@ public IRedisPubSubServer Start()
119119
Name = "RedisPubSubServer " + Interlocked.Increment(ref bgThreadCount)
120120
};
121121
bgThread.Start();
122-
Log.Debug("Started Background Thread: " + bgThread.Name);
122+
if (Log.IsDebugEnabled)
123+
Log.Debug("Started Background Thread: " + bgThread.Name);
123124
}
124125
else
125126
{
126-
Log.Debug("Retrying RunLoop() on Thread: " + bgThread.Name);
127+
if (Log.IsDebugEnabled)
128+
Log.Debug("Retrying RunLoop() on Thread: " + bgThread.Name);
127129
RunLoop();
128130
}
129131
}
@@ -347,7 +349,8 @@ private void Stop(bool shouldRestart)
347349

348350
if (Interlocked.CompareExchange(ref status, Status.Stopping, Status.Started) == Status.Started)
349351
{
350-
Log.Debug("Stopping RedisPubSubServer...");
352+
if (Log.IsDebugEnabled)
353+
Log.Debug("Stopping RedisPubSubServer...");
351354

352355
//Unblock current bgthread by issuing StopCommand
353356
SendControlCommand(Operation.Stop);
@@ -417,7 +420,8 @@ private void HandleFailover(IRedisClientsManager clientsManager)
417420

418421
void HandleUnSubscribe(string channel)
419422
{
420-
Log.Debug("OnUnSubscribe: " + channel);
423+
if (Log.IsDebugEnabled)
424+
Log.Debug("OnUnSubscribe: " + channel);
421425

422426
if (OnUnSubscribe != null)
423427
OnUnSubscribe(channel);

0 commit comments

Comments
 (0)