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

Commit 0d11f3c

Browse files
committed
Rename DisableVerboseLogging to EnableVerboseLogging and disable by default
1 parent 5a0a4f2 commit 0d11f3c

6 files changed

Lines changed: 21 additions & 14 deletions

File tree

src/ServiceStack.Redis/RedisConfig.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,22 @@ public class RedisConfig
8383
public static int? AssumeServerVersion;
8484

8585
/// <summary>
86-
/// How long to hold deactivated clients for before disposing their connection (default 10 seconds)
86+
/// How long to hold deactivated clients for before disposing their connection (default 0 seconds)
8787
/// Dispose of deactivated Clients immediately with TimeSpan.Zero
8888
/// </summary>
89-
public static TimeSpan DeactivatedClientsExpiry = TimeSpan.FromSeconds(10);
89+
public static TimeSpan DeactivatedClientsExpiry = TimeSpan.Zero;
9090

9191
/// <summary>
92-
/// Whether Debug Logging should log detailed Redis operations (default false)
92+
/// Whether Debug Logging should log detailed Redis operations (default true)
9393
/// </summary>
94-
public static bool DisableVerboseLogging = false;
94+
public static bool EnableVerboseLogging = false;
95+
96+
[Obsolete("Use EnableVerboseLogging")]
97+
public static bool DisableVerboseLogging
98+
{
99+
get => !EnableVerboseLogging;
100+
set => EnableVerboseLogging = !value;
101+
}
95102

96103
//Example at: http://msdn.microsoft.com/en-us/library/office/dd633677(v=exchg.80).aspx
97104
public static LocalCertificateSelectionCallback CertificateSelectionCallback { get; set; }
@@ -121,8 +128,8 @@ public static void Reset()
121128
VerifyMasterConnections = true;
122129
HostLookupTimeoutMs = 200;
123130
AssumeServerVersion = null;
124-
DeactivatedClientsExpiry = TimeSpan.FromSeconds(10);
125-
DisableVerboseLogging = false;
131+
DeactivatedClientsExpiry = TimeSpan.Zero;
132+
EnableVerboseLogging = false;
126133
CertificateSelectionCallback = null;
127134
CertificateValidationCallback = null;
128135
AssertAccessOnlyOnSameThread = false;

src/ServiceStack.Redis/RedisManagerPool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public IRedisClient GetClient()
182182
if (inactivePoolIndex == -1 || !stillReserved)
183183
{
184184
if (Log.IsDebugEnabled)
185-
Log.Debug("clients[inactivePoolIndex] != existingClient: {0}".Fmt(!stillReserved ? "!stillReserved" : "-1"));
185+
Log.Debug($"POOL clients[inactivePoolIndex] != existingClient: {(!stillReserved ? "!stillReserved" : "-1")}");
186186

187187
Interlocked.Increment(ref RedisState.TotalClientsCreatedOutsidePool);
188188

src/ServiceStack.Redis/RedisNativeClient_Utils.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ private RedisResponseException CreateResponseError(string error)
302302
{
303303
DeactivatedAt = DateTime.UtcNow;
304304

305-
if (!RedisConfig.DisableVerboseLogging)
305+
if (RedisConfig.EnableVerboseLogging)
306306
{
307307
var safeLastCommand = string.IsNullOrEmpty(Password)
308308
? lastCommand
@@ -374,7 +374,7 @@ protected void WriteCommandToSendBuffer(params byte[][] cmdWithBinaryArgs)
374374
LicenseUtils.AssertValidUsage(LicenseFeature.Redis, QuotaType.RequestsPerHour, __requestsPerHour);
375375
}
376376

377-
if (log.IsDebugEnabled && !RedisConfig.DisableVerboseLogging)
377+
if (log.IsDebugEnabled && RedisConfig.EnableVerboseLogging)
378378
CmdLog(cmdWithBinaryArgs);
379379

380380
//Total command lines count
@@ -476,7 +476,7 @@ internal void FlushSendBuffer()
476476
}
477477
else
478478
{
479-
//Sendling IList<ArraySegment> Throws 'Message to Large' SocketException in Mono
479+
//Sending IList<ArraySegment> Throws 'Message to Large' SocketException in Mono
480480
foreach (var segment in cmdBuffer)
481481
{
482482
var buffer = segment.Array;
@@ -739,7 +739,7 @@ protected string SendExpectString(params byte[][] cmdWithBinaryArgs)
739739

740740
protected void Log(string fmt, params object[] args)
741741
{
742-
if (RedisConfig.DisableVerboseLogging)
742+
if (RedisConfig.EnableVerboseLogging)
743743
return;
744744

745745
log.DebugFormat("{0}", string.Format(fmt, args).Trim());

tests/Console.Tests/BlockingPop.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void Execute()
2525
RedisConfig.VerifyMasterConnections = true;
2626
RedisConfig.HostLookupTimeoutMs = 1000;
2727
RedisConfig.DeactivatedClientsExpiry = TimeSpan.FromSeconds(15);
28-
RedisConfig.DisableVerboseLogging = false;
28+
RedisConfig.EnableVerboseLogging = true;
2929

3030
var redisManager = new RedisManagerPool("localhost?connectTimeout=1000");
3131

tests/Console.Tests/ForceFailover.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class ForceFailover
99
{
1010
public void Execute()
1111
{
12-
RedisConfig.DisableVerboseLogging = true;
12+
RedisConfig.EnableVerboseLogging = false;
1313
LogManager.LogFactory = new ConsoleLogFactory(debugEnabled:true);
1414

1515
var sentinel = new RedisSentinel(new [] {

tests/Console.Tests/RedisSentinelFailoverTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public abstract class RedisSentinelFailoverTests
2323

2424
public void Execute()
2525
{
26-
RedisConfig.DisableVerboseLogging = true;
26+
RedisConfig.EnableVerboseLogging = false;
2727
LogManager.LogFactory = new ConsoleLogFactory(debugEnabled: true);
2828
log = LogManager.GetLogger(GetType());
2929

0 commit comments

Comments
 (0)