本文整理汇总了C#中LogMessage.GetFormattedDateTime方法的典型用法代码示例。如果您正苦于以下问题:C# LogMessage.GetFormattedDateTime方法的具体用法?C# LogMessage.GetFormattedDateTime怎么用?C# LogMessage.GetFormattedDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogMessage
的用法示例。
在下文中一共展示了LogMessage.GetFormattedDateTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormatLogMessageToStringBuilder
/// <summary>
/// Formats the given message as configured and Appends it to the given StringBuilder
/// </summary>
/// <param name="lm">Gives the LogMessage instance to format and Append</param>
/// <param name="ostr">Gives the StringBuilder instance to Append the formatted message into.</param>
public void FormatLogMessageToStringBuilder(LogMessage lm, System.Text.StringBuilder ostr)
{
bool firstItem = (ostr.Length == 0);
if (date) { TabIfNeeded(ostr, ref firstItem); ostr.Append(lm.GetFormattedDateTime()); }
if (qpc) { TabIfNeeded(ostr, ref firstItem); ostr.Append((lm.EmittedQpcTime.Time % 1000.0).ToString("000.000000")); }
if (level) { TabIfNeeded(ostr, ref firstItem); ostr.Append(ConvertToFixedWidthString(lm.MesgType)); }
if (source) { TabIfNeeded(ostr, ref firstItem); ostr.Append(lm.LoggerName); }
{ TabIfNeeded(ostr, ref firstItem); ostr.Append(lm.Mesg); }
if (IncludeKeywords) { ostr.Append(tabStr); ostr.Append(lm.Keywords); }
if (data) { ostr.Append(tabStr); ostr.Append("["); ostr.Append(base64UrlCoder.Encode(lm.Data)); ostr.Append("]"); }
if (IncludeThreadInfo) { ostr.Append(tabStr); ostr.Append(FormatThreadInfo(lm)); }
if (fAndL && lm.SourceStackFrame != null)
{
{ ostr.Append(tabStr); ostr.Append(lm.SourceStackFrame.GetFileName()); }
{ ostr.Append(tabStr); ostr.Append(lm.SourceStackFrame.GetFileLineNumber().ToString()); }
}
{ ostr.Append(endLStr); }
}
示例2: FormatLogMessageToOstream
/// <summary>
/// Formats the given message as configured and incrementally Writes it to the given StreamWriter
/// </summary>
/// <param name="lm">Gives the LogMessage instance to format and Write</param>
/// <param name="os">Gives the StreamWriter instance to Write the formatted message to.</param>
public void FormatLogMessageToOstream(LogMessage lm, System.IO.StreamWriter os)
{
if (!os.BaseStream.CanWrite)
return;
bool firstItem = true;
if (date) { TabIfNeeded(os, ref firstItem); os.Write(lm.GetFormattedDateTime()); }
if (qpc) { TabIfNeeded(os, ref firstItem); os.Write((lm.EmittedQpcTime.Time % 1000.0).ToString("000.000000")); }
if (level) { TabIfNeeded(os, ref firstItem); os.Write(ConvertToFixedWidthString(lm.MesgType)); }
if (source) { TabIfNeeded(os, ref firstItem); os.Write(lm.LoggerName); }
{ TabIfNeeded(os, ref firstItem); os.Write(lm.Mesg); }
if (IncludeKeywords) { os.Write(tabStr); os.Write(lm.Keywords); }
if (data) { os.Write(tabStr); os.Write("[{0}]", base64UrlCoder.Encode(lm.Data)); }
if (IncludeThreadInfo) { os.Write(tabStr); os.Write(FormatThreadInfo(lm)); }
if (fAndL && lm.SourceStackFrame != null)
{
{ os.Write(tabStr); os.Write(lm.SourceStackFrame.GetFileName()); }
{ os.Write(tabStr); os.Write(lm.SourceStackFrame.GetFileLineNumber().ToString()); }
}
{ os.Write(endLStr); }
}