示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CategoryLogger"/> class.
        /// </summary>
        /// <param name="logger">The logger to wrap.</param>
        /// <param name="category">The category.</param>
        public CategoryLogger(IIgniteLogger logger, string category)
        {
            IgniteArgumentCheck.NotNull(logger, nameof(logger));

            // If logger is already a CategoryLogger, get underlying logger instead to avoid unnecessary nesting.
            _logger = logger is CategoryLogger catLogger ? catLogger._logger : logger;

            _category = category;
        }
示例#2
0
 /// <summary>
 /// Logs the message with <see cref="LogLevel.Debug"/> level.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="message">The message.</param>
 /// <param name="args">The arguments.</param>
 public static void Debug(this IIgniteLogger logger, string message, params object[] args)
 {
     Log(logger, LogLevel.Debug, message, args);
 }
示例#3
0
 /// <summary>
 /// Logs the message with <see cref="LogLevel.Debug"/> level.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="message">The message.</param>
 public static void Debug(this IIgniteLogger logger, string message)
 {
     Log(logger, LogLevel.Debug, message);
 }
示例#4
0
 /// <summary>
 /// Logs the message with <see cref="LogLevel.Trace"/> level.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="ex">The exception.</param>
 /// <param name="message">The message.</param>
 /// <param name="args">The arguments.</param>
 public static void Trace(this IIgniteLogger logger, Exception ex, string message, params object[] args)
 {
     Log(logger, LogLevel.Trace, ex, message, args);
 }
示例#5
0
 /// <summary>
 /// Logs the message with <see cref="LogLevel.Trace"/> level.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="ex">The exception.</param>
 /// <param name="message">The message.</param>
 public static void Trace(this IIgniteLogger logger, Exception ex, string message)
 {
     Log(logger, LogLevel.Trace, ex, message);
 }
示例#6
0
        /// <summary>
        /// Gets the <see cref="CategoryLogger"/> with a specified category that wraps provided logger.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="category">The category.</param>
        /// <returns>Logger that uses specified category when no other category is provided.</returns>
        public static IIgniteLogger GetLogger(this IIgniteLogger logger, string category)
        {
            IgniteArgumentCheck.NotNull(logger, "logger");

            return(new CategoryLogger(logger, category));
        }
示例#7
0
        /// <summary>
        /// Logs the message.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="level">The level.</param>
        /// <param name="ex">The exception.</param>
        /// <param name="message">The message.</param>
        /// <param name="args">The arguments.</param>
        public static void Log(this IIgniteLogger logger, LogLevel level, Exception ex, string message, params object[] args)
        {
            IgniteArgumentCheck.NotNull(logger, "logger");

            logger.Log(level, message, args, CultureInfo.InvariantCulture, null, null, ex);
        }
示例#8
0
        /// <summary>
        /// Logs the message.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="level">The level.</param>
        /// <param name="ex">The exception.</param>
        /// <param name="message">The message.</param>
        public static void Log(this IIgniteLogger logger, LogLevel level, Exception ex, string message)
        {
            IgniteArgumentCheck.NotNull(logger, "logger");

            logger.Log(level, message, null, null, null, null, ex);
        }
示例#9
0
 /// <summary>
 /// Logs the message with <see cref="LogLevel.Error"/> level.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="ex">The exception.</param>
 /// <param name="message">The message.</param>
 public static void Error(this IIgniteLogger logger, Exception ex, string message)
 {
     Log(logger, LogLevel.Error, ex, message);
 }
示例#10
0
 /// <summary>
 /// Logs the message with <see cref="LogLevel.Error"/> level.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="message">The message.</param>
 /// <param name="args">The arguments.</param>
 public static void Error(this IIgniteLogger logger, string message, params object[] args)
 {
     Log(logger, LogLevel.Error, message, args);
 }
示例#11
0
 /// <summary>
 /// Logs the message with <see cref="LogLevel.Warn"/> level.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="ex">The exception.</param>
 /// <param name="message">The message.</param>
 public static void Warn(this IIgniteLogger logger, Exception ex, string message)
 {
     Log(logger, LogLevel.Warn, ex, message);
 }
示例#12
0
 /// <summary>
 /// Logs the message with <see cref="LogLevel.Info"/> level.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="ex">The exception.</param>
 /// <param name="message">The message.</param>
 public static void Info(this IIgniteLogger logger, Exception ex, string message)
 {
     Log(logger, LogLevel.Info, ex, message);
 }