/// <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; }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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)); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }