本文整理汇总了C#中log4net.ILog.ServiceMessage方法的典型用法代码示例。如果您正苦于以下问题:C# ILog.ServiceMessage方法的具体用法?C# ILog.ServiceMessage怎么用?C# ILog.ServiceMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log4net.ILog
的用法示例。
在下文中一共展示了ILog.ServiceMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderToTeamCity
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 });
}