Permalink
Browse files

Added tracing for sends to the connection.

  • Loading branch information...
1 parent 7dcdc8f commit f3829eafdf79013888df81750e58bfced013b1b9 @davidfowl davidfowl committed Jul 22, 2012
Showing with 30 additions and 0 deletions.
  1. +30 −0 SignalR/Connection.cs
View
@@ -143,6 +143,8 @@ private void ProcessCommand(SignalCommand command)
private Task SendMessage(string key, object value)
{
+ TraceSend(key, value);
+
var wrappedValue = new WrappedValue(value, _serializer);
return _messageBus.Send(_connectionId, key, wrappedValue).Catch();
}
@@ -155,5 +157,33 @@ private void PopulateResponseState(PersistentResponse response)
response.TransportData["Groups"] = _groups;
}
}
+
+ private void TraceSend(string key, object value)
+ {
+ var command = value as SignalCommand;
+ if (command != null)
+ {
+ if (command.Type == CommandType.AddToGroup)
+ {
+ Trace.TraceInformation("Sending Add to group '{0}'.", command.Value);
+ }
+ else if (command.Type == CommandType.RemoveFromGroup)
+ {
+ Trace.TraceInformation("Sending Remove from group '{0}'.", command.Value);
+ }
+ else if (command.Type == CommandType.Abort)
+ {
+ Trace.TraceInformation("Sending Aborted command '{0}'", _connectionId);
+ }
+ else
+ {
+ Trace.TraceInformation("Sending message to '{0}'", key);
+ }
+ }
+ else
+ {
+ Trace.TraceInformation("Sending message to '{0}'", key);
+ }
+ }
}
}

0 comments on commit f3829ea

Please sign in to comment.