aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/csharp/Grpc.Core/Internal/AsyncCallBase.cs')
-rw-r--r--src/csharp/Grpc.Core/Internal/AsyncCallBase.cs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs
index 64713c8c52..38f2a5baeb 100644
--- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs
+++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs
@@ -38,6 +38,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Grpc.Core.Internal;
+using Grpc.Core.Logging;
using Grpc.Core.Utils;
namespace Grpc.Core.Internal
@@ -48,6 +49,8 @@ namespace Grpc.Core.Internal
/// </summary>
internal abstract class AsyncCallBase<TWrite, TRead>
{
+ static readonly ILogger Logger = GrpcEnvironment.Logger.ForType<AsyncCallBase<TWrite, TRead>>();
+
readonly Func<TWrite, byte[]> serializer;
readonly Func<byte[], TRead> deserializer;
@@ -233,9 +236,9 @@ namespace Grpc.Core.Internal
payload = serializer(msg);
return true;
}
- catch (Exception)
+ catch (Exception e)
{
- Console.WriteLine("Exception occured while trying to serialize message");
+ Logger.Error(e, "Exception occured while trying to serialize message");
payload = null;
return false;
}
@@ -248,9 +251,9 @@ namespace Grpc.Core.Internal
msg = deserializer(payload);
return true;
}
- catch (Exception)
+ catch (Exception e)
{
- Console.WriteLine("Exception occured while trying to deserialize message");
+ Logger.Error(e, "Exception occured while trying to deserialize message.");
msg = default(TRead);
return false;
}
@@ -264,7 +267,7 @@ namespace Grpc.Core.Internal
}
catch (Exception e)
{
- Console.WriteLine("Exception occured while invoking completion delegate: " + e);
+ Logger.Error(e, "Exception occured while invoking completion delegate.");
}
}