Exemple #1
0
        private static void Fatal(string message, System.Exception exception, System.Type ownerType, string loggerName)
        {
            ILogger logger = null;

            if (!Log.Enabled)
            {
                return;
            }
            if (ownerType != null)
            {
                logger = LoggerManager.GetLogger(Assembly.GetCallingAssembly(), ownerType);
            }
            else
            {
                logger = LoggerManager.GetLogger(Assembly.GetCallingAssembly(), loggerName);
            }

            if (logger != null)
            {
                if (exception != null)
                {
                    logger.Log(typeof(Log).ToString(), Level.FATAL, message, exception);
                }
                else
                {
                    logger.Log(typeof(Log).ToString(), Level.FATAL, message, null);
                }
                if (SystemCount.LoggingFatalsLogged != null)
                {
                    SystemCount.LoggingFatalsLogged.Increment(1L);
                }
            }
            LogNotification.RaiseNotification(LogNotificationLevel.Fatal, message, exception);
        }
Exemple #2
0
        private static void Info(string message, object owner, string loggerName)
        {
            ILogger logger = null;

            if (!Log.Enabled)
            {
                return;
            }
            if (owner != null)
            {
                logger = LoggerManager.GetLogger(Assembly.GetCallingAssembly(), owner.GetType());
            }
            else
            {
                logger = LoggerManager.GetLogger(Assembly.GetCallingAssembly(), loggerName);
            }

            if (logger != null)
            {
                logger.Log(typeof(Log).ToString(), Level.INFO, message, null);
                if (SystemCount.LoggingInformationsLogged != null)
                {
                    SystemCount.LoggingInformationsLogged.Increment(1L);
                }
            }
            LogNotification.RaiseNotification(LogNotificationLevel.Info, message);
        }
Exemple #3
0
        private static void Warn(string message, System.Exception exception, object owner, string loggerName)
        {
            ILogger logger = null;

            if (!Log.Enabled)
            {
                return;
            }
            if (owner != null)
            {
                logger = LoggerManager.GetLogger(Assembly.GetCallingAssembly(), owner.GetType());
            }
            else
            {
                logger = LoggerManager.GetLogger(Assembly.GetCallingAssembly(), loggerName);
            }

            if (logger != null)
            {
                if (exception != null)
                {
                    logger.Log(typeof(Log).ToString(), Level.WARN, message, exception);
                }
                else
                {
                    logger.Log(typeof(Log).ToString(), Level.WARN, message, null);
                }
                if (SystemCount.LoggingWarningsLogged != null)
                {
                    SystemCount.LoggingWarningsLogged.Increment(1L);
                }
            }
            LogNotification.RaiseNotification(LogNotificationLevel.Warning, message, exception);
        }
Exemple #4
0
 /// <summary>
 /// Logs a single fatal message.
 /// </summary>
 /// <param name="message">
 /// The message.
 /// </param>
 /// <param name="exception">
 /// The exception.
 /// </param>
 /// <param name="ownerType">
 /// Type of the owner.
 /// </param>
 public static void SingleFatal(string message, System.Exception exception, System.Type ownerType)
 {
     Assert.ArgumentNotNull(message, "message");
     Assert.ArgumentNotNull(ownerType, "ownerType");
     if (!Log.Enabled || Log.Singles == null || Log.Singles.ContainsKey(message))
     {
         return;
     }
     Log.Fatal(string.Format("SINGLE MSG: {0}", message), exception, ownerType);
     Log.Singles.Add(message, string.Empty);
     LogNotification.RaiseNotification(LogNotificationLevel.Fatal, message, exception);
 }