Skip to content

Commit

Permalink
Added tracing for sends to the connection.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfowl committed Jul 22, 2012
1 parent 7dcdc8f commit f3829ea
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions SignalR/Connection.cs
Expand Up @@ -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();
}
Expand All @@ -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.