本文整理汇总了C#中Logger.?.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# Logger.?.WriteLine方法的具体用法?C# Logger.?.WriteLine怎么用?C# Logger.?.WriteLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger.?.WriteLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeforeCatch
/// <summary>
/// Exception filter function used to report exceptions to telemetry. This **ALWAYS** returns 'true'.
/// </summary>
/// <param name="currentException">The current exception which is about to be caught.</param>
/// <param name="logger">For logging messages</param>
/// <param name="reportOnlyCorrupting">If true, only corrupting exceptions are reported</param>
/// <returns>true</returns>
public static bool BeforeCatch(Exception currentException, Logger logger, bool reportOnlyCorrupting)
{
if (reportOnlyCorrupting && !IsCorruptingException(currentException))
{
return true; // ignore non-corrupting exceptions
}
try
{
HostTelemetry.ReportCurrentException(currentException, "Microsoft.MIDebugEngine");
logger?.WriteLine("EXCEPTION: " + currentException.GetType());
logger?.WriteTextBlock("EXCEPTION: ", currentException.StackTrace);
}
catch
{
// If anything goes wrong, ignore it. We want to report the original exception, not a telemetry problem
}
return true;
}
示例2: MakeFifo
internal static string MakeFifo(Logger logger = null)
{
string path = Path.Combine(Path.GetTempPath(), FifoPrefix + Path.GetRandomFileName());
// Mod is normally in octal, but C# has no octal values. This is 384 (rw owner, no rights anyone else)
const int rw_owner = 384;
byte[] pathAsBytes = new byte[Encoding.UTF8.GetByteCount(path) + 1];
Encoding.UTF8.GetBytes(path, 0, path.Length, pathAsBytes, 0);
int result = UnixNativeMethods.MkFifo(pathAsBytes, rw_owner);
if (result != 0)
{
// Failed to create the fifo. Bail.
logger?.WriteLine("Failed to create fifo");
throw new ArgumentException("MakeFifo failed to create fifo at path {0}", path);
}
return path;
}