本文整理汇总了C#中LogEntry.StackFrameOrType方法的典型用法代码示例。如果您正苦于以下问题:C# LogEntry.StackFrameOrType方法的具体用法?C# LogEntry.StackFrameOrType怎么用?C# LogEntry.StackFrameOrType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogEntry
的用法示例。
在下文中一共展示了LogEntry.StackFrameOrType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Enqueue
/// <summary>
/// Enqueue to be written
/// </summary>
/// <param name="entry"></param>
/// <remarks>
/// The entry might be written directly in the same thread or enqueued to be written
/// later. It's up to each implementation to decide. Keep in mind that a logger should not
/// introduce delays in the thread execution. If it's possible that it will delay the thread,
/// enqueue entries instead and write them in a seperate thread.
/// </remarks>
public void Enqueue(LogEntry entry)
{
string method = entry.StackFrameOrType();
string tmp = String.Format("{0} {1} {2} {3} {4}",
entry.CreatedAt.ToString("yyyy-MM-dd HH:mm:ss.fff"),
entry.ThreadId.ToString().PadLeft(3),
entry.UserName.PadRight(25),
method.PadRight(40),
entry.Message.Replace("\r\n", "\r\n\t"));
Console.ForegroundColor = GetColor(entry);
Console.WriteLine(tmp);
if (entry.Exception != null)
{
Exception exception = entry.Exception;
string tabs = "\t";
while (exception != null)
{
Console.WriteLine(tabs + entry.Exception.ToString().Replace("\r\n", "\r\n" + tabs));
exception = exception.InnerException;
tabs += "\t";
}
}
Console.ForegroundColor = ConsoleColor.Gray;
}