void RenderToTeamCity(ActivityElement element, ILog log) { if (!IsPrintable(element)) return; var blockName = element.Status + ": " + element.Name; log.ServiceMessage("blockOpened", new { name = blockName }); foreach (var logEntry in element.LogElements) { var lines = logEntry.MessageText.Split('\n').Where(l => !string.IsNullOrWhiteSpace(l)).ToArray(); foreach (var line in lines) { log.ServiceMessage("message", new { text = line, status = ConvertToTeamCityMessageStatus(logEntry.Category) }); } } foreach (var child in element.Children) { RenderToTeamCity(child, log); } log.ServiceMessage("blockClosed", new { name = blockName }); }