Beispiel #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;
        }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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));
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
 }