Browse files

Even more logging.

  • Loading branch information...
1 parent 622470c commit 768fb5956f2f69b6c57a484a3aee367dc0d42ba0 @enyim committed Sep 10, 2010
View
10 Enyim.Caching/Memcached/Protocol/Binary/DeleteOperation.cs
@@ -1,9 +1,11 @@
using System.Collections.Generic;
+using System.Text;
namespace Enyim.Caching.Memcached.Protocol.Binary
{
public class DeleteOperation : BinarySingleItemOperation, IDeleteOperation
{
+ private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(DeleteOperation));
public DeleteOperation(string key) : base(key) { }
protected override BinaryRequest Build()
@@ -23,6 +25,14 @@ protected internal override bool ReadResponse(PooledSocket socket)
var retval = response.Read(socket);
this.Cas = response.CAS;
+#if EVEN_MORE_LOGGING
+ if (log.IsDebugEnabled)
+ if (retval)
+ log.DebugFormat("Delete succeeded for key '{0}'. Reason: {1}", this.Key);
+ else
+ log.DebugFormat("Delete failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
+#endif
+
return retval;
}
}
View
12 Enyim.Caching/Memcached/Protocol/Binary/GetOperation.cs
@@ -1,9 +1,11 @@
using System.Collections.Generic;
+using System.Text;
namespace Enyim.Caching.Memcached.Protocol.Binary
{
public class GetOperation : BinarySingleItemOperation, IGetOperation
{
+ private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(GetOperation));
private CacheItem result;
public GetOperation(string key) : base(key) { }
@@ -29,11 +31,21 @@ protected internal override bool ReadResponse(PooledSocket socket)
this.result = new CacheItem((ushort)flags, response.Data);
this.Cas = response.CAS;
+#if EVEN_MORE_LOGGING
+ if (log.IsDebugEnabled)
+ log.DebugFormat("Get succeeded for key '{0}'.", this.Key);
+#endif
+
return true;
}
this.Cas = 0;
+#if EVEN_MORE_LOGGING
+ if (log.IsDebugEnabled)
+ log.DebugFormat("Get failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
+#endif
+
return false;
}
View
8 Enyim.Caching/Memcached/Protocol/Binary/StoreOperation.cs
@@ -52,9 +52,13 @@ protected internal override bool ReadResponse(PooledSocket socket)
var retval = response.Read(socket);
this.Cas = response.CAS;
- if (!retval)
- if (log.IsDebugEnabled)
+#if EVEN_MORE_LOGGING
+ if (log.IsDebugEnabled)
+ if (retval)
+ log.DebugFormat("Store succeeded for key '{0}'. Reason: {1}", this.Key);
+ else
log.DebugFormat("Store failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
+#endif
return retval;
}

0 comments on commit 768fb59

Please sign in to comment.