Exemple #1
0
        /// <summary>
        /// Call the appenders.
        /// </summary>
        /// <param name="severity">The log severity level.</param>
        /// <param name="message">The log message</param>
        /// <param name="filename">The name of the file.</param>
        /// <param name="lineNumber">The line number of the file.</param>
        public void LogMessage(LogSeverity severity, string message, string filename, int lineNumber)
        {
            string formattedMessage = formatter.FormatString(filename, severity, lineNumber, message);

            foreach (ILogAppender appender in Appenders)
            {
                if (LogFilter == null)
                {
                    appender.AppendLog(severity, formattedMessage);
                }
                else
                {
                    if (LogFilter.IsLoggable(severity, message, filename, lineNumber))
                    {
                        appender.AppendLog(severity, formattedMessage);
                    }
                }

                if (severity >= LogSeverity.ERROR)
                {
                    if (ErrorHandler != null)
                    {
                        ErrorHandler.HandleError(severity, message, filename, lineNumber);
                    }
                }
            }
        }