本文整理汇总了C#中ILog.FatalFormat方法的典型用法代码示例。如果您正苦于以下问题:C# ILog.FatalFormat方法的具体用法?C# ILog.FatalFormat怎么用?C# ILog.FatalFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILog
的用法示例。
在下文中一共展示了ILog.FatalFormat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CallAllMethodsOnLog
protected void CallAllMethodsOnLog(ILog log)
{
Assert.IsTrue(log.IsDebugEnabled);
Assert.IsTrue(log.IsErrorEnabled);
Assert.IsTrue(log.IsFatalEnabled);
Assert.IsTrue(log.IsInfoEnabled);
Assert.IsTrue(log.IsWarnEnabled);
log.Debug("Testing DEBUG");
log.Debug("Testing DEBUG Exception", new Exception());
log.DebugFormat("Testing DEBUG With {0}", "Format");
log.Info("Testing INFO");
log.Info("Testing INFO Exception", new Exception());
log.InfoFormat("Testing INFO With {0}", "Format");
log.Warn("Testing WARN");
log.Warn("Testing WARN Exception", new Exception());
log.WarnFormat("Testing WARN With {0}", "Format");
log.Error("Testing ERROR");
log.Error("Testing ERROR Exception", new Exception());
log.ErrorFormat("Testing ERROR With {0}", "Format");
log.Fatal("Testing FATAL");
log.Fatal("Testing FATAL Exception", new Exception());
log.FatalFormat("Testing FATAL With {0}", "Format");
}
示例2: Main
public static int Main()
{
LogManager.Adapter = new Log4NetLoggerFactoryAdapter(new NameValueCollection { { "configType", "FILE-WATCH" }, { "configFile", "~/log4net.config" } });
_logger = LogManager.GetLogger<Program>();
try
{
_logger.Info("Starting service...");
using (StartHost())
{
_logger.Info("Started service...");
Thread.Sleep(Timeout.InfiniteTimeSpan);
}
}
catch (ThreadInterruptedException) { }
catch (Exception e)
{
_logger.FatalFormat("Service has terminated unexpectedly.", e);
return 1;
}
return 0;
}
示例3: LogFormat
public static void LogFormat(this IEnableLog This, ILog logger, LogType type, string format, params object[] args)
{
switch (type)
{
case LogType.Debug:
logger.DebugFormat(format, args);
break;
case LogType.Error:
logger.ErrorFormat(format, args);
break;
case LogType.Fatal:
logger.FatalFormat(format, args);
break;
case LogType.Info:
logger.InfoFormat(format, args);
break;
case LogType.Warn:
logger.WarnFormat(format, args);
break;
}
}
示例4: DefaultWriteLogEvent
protected static void DefaultWriteLogEvent(ILog commonLog, TraceEventType traceEventType, String message, Exception ex)
{
switch (traceEventType)
{
case TraceEventType.Critical:
commonLog.FatalFormat(message, ex);
break;
case TraceEventType.Error:
commonLog.ErrorFormat(message, ex);
break;
case TraceEventType.Warning:
commonLog.WarnFormat(message, ex);
break;
case TraceEventType.Information:
commonLog.InfoFormat(message, ex);
break;
case TraceEventType.Verbose:
commonLog.TraceFormat(message, ex);
break;
case TraceEventType.Start:
commonLog.DebugFormat(message, ex);
break;
case TraceEventType.Stop:
commonLog.DebugFormat(message, ex);
break;
case TraceEventType.Suspend:
commonLog.DebugFormat(message, ex);
break;
case TraceEventType.Resume:
commonLog.DebugFormat(message, ex);
break;
case TraceEventType.Transfer:
commonLog.DebugFormat(message, ex);
break;
default:
throw new ArgumentOutOfRangeException("traceEventType");
}
}
示例5: CanLogMessageWithException
protected virtual void CanLogMessageWithException(ILog log)
{
log.TraceFormat("Hi {0}", new ArithmeticException(), "dude");
log.DebugFormat("Hi {0}", new ArithmeticException(), "dude");
log.InfoFormat("Hi {0}", new ArithmeticException(), "dude");
log.WarnFormat("Hi {0}", new ArithmeticException(), "dude");
log.ErrorFormat("Hi {0}", new ArithmeticException(), "dude");
log.FatalFormat("Hi {0}", new ArithmeticException(), "dude");
}