/// <summary> /// Logs the message with specified parameters. /// </summary> /// <param name="level">Logging level.</param> /// <param name="message">The message to be logged.</param> /// <param name="parameters">Parameters which are used to format logging message.</param> /// <param name="rootException">Exception which causes this log.</param> private void DoLogging(LogLevel level, string message, object[] parameters, Exception rootException) { if (logger.IsEnabledFor(level.WrappedLevel)) { if (null != parameters && !string.IsNullOrEmpty(message)) { message = string.Format(message, parameters); } LogMessage loggerMessage = new LogMessage(message, rootException); logger.Log(this.GetType(), level.WrappedLevel, loggerMessage, rootException); } }
/// <summary> /// Log the message. /// </summary> /// <param name="type">The type of the logger.</param> /// <param name="level">The level of the log.</param> /// <param name="message">The message to be logged.</param> public static void Log(LoggerType type, LogLevel level, string message) { Log(type, level, message, null); }
/// <summary> /// Log the message with exception. /// </summary> /// <param name="type">The type of the logger.</param> /// <param name="level">The level of the log.</param> /// <param name="message">The message to be logged.</param> /// <param name="parameters">The parameters used to format the message.</param> /// <param name="rootException">The exception to be logged.</param> public static void Log(LoggerType type, LogLevel level, string message, object[] parameters, Exception rootException) { Logger logger = LoggerPool.GetLogger(type); if (logger != null) { logger.Log(level, message, parameters, rootException); } }
/// <summary> /// Log the message with parameters for the message retrieved from the resource file. /// </summary> /// <param name="type">The type of the logger.</param> /// <param name="level">The level of the log.</param> /// <param name="message">The message to be logged.</param> /// <param name="parameters">The parameters used to format the message.</param> public static void Log(LoggerType type, LogLevel level, string message, object[] parameters) { Log(type, level, message, parameters, null); }
/// <summary> /// Log a message with specified level, message key, format parameter, /// and exception which causes the error. /// </summary> /// <param name="level">Logging level.</param> /// <param name="message">The message to be logged.</param> /// <param name="parameters">Parameters which are used to format the logging message.</param> /// <param name="rootException">Exception which causes this log.</param> internal void Log(LogLevel level, string message, object[] parameters, Exception rootException) { DoLogging(level, message, parameters, rootException); }
/// <summary> /// Log a message with specified level, message key and format parameter. /// </summary> /// <param name="level">Logging level.</param> /// <param name="message">The message to be logged.</param> /// <param name="parameters">Parameters which are used to format the logging message.</param> internal void Log(LogLevel level, string message, object[] parameters) { Log(level, message, parameters, null); }
/// <summary> /// Log a message with specified level and message key. /// </summary> /// <param name="level">Logging level.</param> /// <param name="message">The message to be logged.</param> internal void Log(LogLevel level, string message) { Log(level, message, null); }