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


C# ILog.Fatal方法代码示例

本文整理汇总了C#中ILog.Fatal方法的典型用法代码示例。如果您正苦于以下问题:C# ILog.Fatal方法的具体用法?C# ILog.Fatal怎么用?C# ILog.Fatal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILog的用法示例。


在下文中一共展示了ILog.Fatal方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: AccessException

        public static void AccessException(this IIdempotenceService service, ILog log, Exception ex, ObservablePipeline pipeline)
        {
            Guard.AgainstNull(service, "service");
            Guard.AgainstNull(log, "log");
            Guard.AgainstNull(ex, "ex");
            Guard.AgainstNull(pipeline, "pipeline");

            log.Fatal(string.Format( ESBResources.FatalIdempotenceServiceException, service.GetType().FullName, ex.CompactMessages()));

            pipeline.Abort();
        }
开发者ID:jessezhao,项目名称:shuttle-esb,代码行数:11,代码来源:IdempotenceServiceExtensions.cs

示例3: InternalTest

        private static void InternalTest(ILog log)
        {
            const string message = "add record in db";


            log.Debug(message);
            log.Debug(message, new Exception());
            log.DebugFormat(message);

            log.Error(message);
            log.Error(message, new Exception());
            log.ErrorFormat(message);

            log.Fatal(message);
            log.Fatal(message, new Exception());
            


            log.Info(message);
            log.Info(message, new Exception());
            log.InfoFormat(message);

            log.Warn(message);
            log.Warn(message, new Exception());
            log.WarnFormat(message);

            Console.WriteLine(log.IsDebugEnabled);
            Console.WriteLine(log.IsErrorEnabled);
            Console.WriteLine(log.IsFatalEnabled);
            Console.WriteLine(log.IsInfoEnabled);
            Console.WriteLine(log.IsWarnEnabled);

            //log.TryLogFail(ErrorAction).Exception(e => Console.WriteLine(e.Message));
            //log.TryLogFail(SuccessAction).Success(()=>{});

        }
开发者ID:netcasewqs,项目名称:nlite,代码行数:36,代码来源:LoggerTest.cs

示例4: AccessDenied

        public static void AccessDenied(ILog log, string path)
        {
            Guard.AgainstNull(log, "log");
            Guard.AgainstNull(path, "path");

            log.Fatal(
                string.Format(
                    MsmqResources.AccessDenied,
                    WindowsIdentity.GetCurrent() != null
                        ? WindowsIdentity.GetCurrent().Name
                        : MsmqResources.Unknown,
                    path));

            if (Environment.UserInteractive)
            {
                return;
            }

            Process.GetCurrentProcess().Kill();
        }
开发者ID:jessezhao,项目名称:shuttle-esb,代码行数:20,代码来源:MsmqQueue.cs

示例5: Log

 public static void Log(this IEnableLog This, LogType type, object message, ILog logger = null)
 {
     logger = logger ?? LogManager.GetLogger(This.GetType());
     switch (type)
     {
         case LogType.Debug:
             logger.Debug(message);
             break;
         case LogType.Error:
             logger.Error(message);
             break;
         case LogType.Fatal:
             logger.Fatal(message);
             break;
         case LogType.Info:
             logger.Info(message);
             break;
         case LogType.Warn:
             logger.Warn(message);
             break;
     }
 }
开发者ID:KyleGobel,项目名称:Deerso.Logging,代码行数:22,代码来源:IEnableLog.cs

示例6: WriteToLog

 private void WriteToLog(LogLevel logLevel, ILog log, string text, Exception e)
 {
     switch (logLevel)
     {
         case LogLevel.All:
         case LogLevel.Trace:
             if (log.IsTraceEnabled)
             {
                 if (e == null) log.Trace(text); else log.Trace(text, e);
             }
             break;
         case LogLevel.Debug:
             if (log.IsDebugEnabled)
             {
                 if (e == null) log.Debug(text); else log.Debug(text, e);
             }
             break;
         case LogLevel.Error:
             if (log.IsErrorEnabled)
             {
                 if (e == null) log.Error(text); else log.Error(text, e);
             }
             break;
         case LogLevel.Fatal:
             if (log.IsFatalEnabled)
             {
                 if (e == null) log.Fatal(text); else log.Fatal(text, e);
             }
             break;
         case LogLevel.Info:
             if (log.IsInfoEnabled)
             {
                 if (e == null) log.Info(text); else log.Info(text, e);
             }
             break;
         case LogLevel.Warn:
             if (log.IsWarnEnabled)
             {
                 if (e == null) log.Warn(text); else log.Warn(text, e);
             }
             break;
         case LogLevel.Off:
         default:
             break;
     }
 }
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:46,代码来源:SimpleLoggingAdvice.cs

示例7: WriteLog

 /// <summary>
 /// 写日志
 /// </summary>
 /// <param name="log">日志组件</param>
 public void WriteLog( ILog log ) {
     switch ( Level ) {
         case LogLevel.Debug:
             log.Debug();
             break;
         case LogLevel.Information:
             log.Info();
             break;
         case LogLevel.Warning:
             log.Warn();
             break;
         case LogLevel.Error:
             log.Error();
             break;
         case LogLevel.Fatal:
             log.Fatal();
             break;
     }
 }
开发者ID:NetUtil,项目名称:Util,代码行数:23,代码来源:Warning.cs

示例8: CanLogMessageWithException

 protected virtual void CanLogMessageWithException(ILog log)
 {
     log.Trace(m => m("Hi {0}", "dude"));
     log.Debug(m => m("Hi {0}", "dude"), new ArithmeticException());
     log.Info(m => m("Hi {0}", "dude"), new ArithmeticException());
     log.Warn(m => m("Hi {0}", "dude"), new ArithmeticException());
     log.Error(m => m("Hi {0}", "dude"), new ArithmeticException());
     log.Fatal(m => m("Hi {0}", "dude"), new ArithmeticException());
 }
开发者ID:briandealwis,项目名称:gt,代码行数:9,代码来源:AbstractSimpleLogTest.cs

示例9: CanLogMessage

 protected virtual void CanLogMessage(ILog log)
 {
     log.TraceFormat("Hi");
     log.Debug("Hi");
     log.Info("Hi");
     log.Warn("Hi");
     log.Error("Hi");
     log.Fatal("Hi");
 }
开发者ID:briandealwis,项目名称:gt,代码行数:9,代码来源:AbstractSimpleLogTest.cs

示例10: Log

 private void Log(ILog logger, string message)
 {
     switch (Level)
     {
         case LogLevel.Debug:
             logger.Debug(message);
             break;
         case LogLevel.Error:
             logger.Error(message);
             break;
         case LogLevel.Fatal:
             logger.Fatal(message);
             break;
         case LogLevel.Info:
             logger.Info(message);
             break;
         case LogLevel.Warn:
             logger.Warn(message);
             break;
     }
 }
开发者ID:netcasewqs,项目名称:nlite,代码行数:21,代码来源:LoggerInterceptor.cs

示例11: Log

		/**
		 * Logs the exception to the appropriate log level if the exception is annotated with
		 * <code>@RestrictedLevel</code>. Otherwise log normally.
		 * @param log the logger
		 * @param logLevel the desired log level
		 * @param message the error message
		 * @param t the exception
		 */
		private static void Log (ILog log, LogLevel logLevel, object message, Exception ex)
		{
			string theMessage = BuildExceptionMessage(Convert.ToString(message), ex);
			if (logLevel.Equals(LogLevel.Fatal))
			{
				log.Fatal(theMessage, ex != null ? ex : null);
			}
			else if (logLevel.Equals(LogLevel.Error))
			{
				log.Error(theMessage, ex != null ? ex : null);
			}
			else if (logLevel.Equals(LogLevel.Warn))
			{
				log.Warn(theMessage, ex != null ? ex : null);
			}
			else if (logLevel.Equals(LogLevel.Info))
			{
				log.Info(theMessage, ex != null ? ex : null);
			}
			else if (logLevel.Equals(LogLevel.Debug))
			{
				log.Debug(theMessage, ex != null ? ex : null);
			}
			else if (logLevel.Equals(LogLevel.Trace))
			{
				//log.Trace(theMessage, ex != null ? ex : null);
				log.Debug(theMessage, ex != null ? ex : null);
			}
		}
开发者ID:extesla,项目名称:OpenGamingLibrary,代码行数:37,代码来源:Logger.cs


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