当前位置: 首页>>代码示例>>C#>>正文


C# ILog.FatalFormat方法代码示例

本文整理汇总了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");
        }
开发者ID:afyles,项目名称:NServiceBus,代码行数:28,代码来源:BaseLoggerFactoryTests.cs

示例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;
 }
开发者ID:wongatech,项目名称:HealthMonitoring,代码行数:21,代码来源:Program.cs

示例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;
     }
 }
开发者ID:KyleGobel,项目名称:Deerso.Logging,代码行数:21,代码来源:IEnableLog.cs

示例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");
     }
 }
开发者ID:richarddbarnett,项目名称:Owin.Logging.Common,代码行数:38,代码来源:CommonLoggingFactory.cs

示例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");
 }
开发者ID:briandealwis,项目名称:gt,代码行数:9,代码来源:AbstractSimpleLogTest.cs


注:本文中的ILog.FatalFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。