本文整理汇总了C#中EventLevel.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# EventLevel.ToString方法的具体用法?C# EventLevel.ToString怎么用?C# EventLevel.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventLevel
的用法示例。
在下文中一共展示了EventLevel.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LogMessage
private static void LogMessage(EventLevel eventLevel, string message)
{
UdpEvent("log", new { level = eventLevel.ToString(), message = message });
}
示例2: LogBase
/// <summary>
/// Base logging implementation
/// </summary>
/// <param name="message">Message to be logged</param>
/// <param name="ex">Exception to be logged, null can be passed if there are no exception details</param>
/// <param name="level">Level to be used for the logged message</param>
/// <param name="category">Category to be used for the logged message</param>
static void LogBase(string message, Exception ex, EventLevel level, EventCategory category)
{
var msg = string.Format("{0} {1}: {2}", category.ToString().PadRight(15), level.ToString().PadRight(15), message);
if (ex != null)
msg += "\r\nEXCEPTION: " + ex;
// Log to Console
Console.WriteLine(msg);
// Log to Debug
Debug.WriteLine(msg);
// TODO: Log to other logging providers here
}
示例3: GetLevelName
private static string GetLevelName(EventLevel level)
{
return (((int)level >= 16) ? "" : "win:") + level.ToString();
}
示例4: GetLevelName
private static string GetLevelName(EventLevel level)
{
//
return "win:" + level.ToString();
}
示例5: LogMdsEvent
private static void LogMdsEvent(HttpRequestMessage request, string requestUri, EventLevel level, string formattedMessage, object[] parameters)
{
if (request != null)
{
object perRequestTrace;
if (!request.Properties.TryGetValue("perRequestTrace", out perRequestTrace))
{
perRequestTrace = new MdsRow();
request.Properties["perRequestTrace"] = perRequestTrace;
}
if (perRequestTrace != null)
{
var mdsRow = perRequestTrace as MdsRow;
if (mdsRow != null)
{
mdsRow.Messages.Add(new TraceMessage()
{
TimeStamp = DateTime.UtcNow.ToString("o"),
Level = level.ToString(),
Message = formattedMessage
});
}
}
}
else
{
}
}