public static INDLogBuilder Error(this INDLogger logger) { if (!logger.IsEnabled(NDLogLevel.Error)) { return(NDNullLogBuilder.Instance); } return(new NDLogBuilder(NDLogLevel.Error, logger)); }
public static INDLogBuilder Critical(this INDLogger logger) { if (!logger.IsEnabled(NDLogLevel.Critical)) { return(NDNullLogBuilder.Instance); } return(new NDLogBuilder(NDLogLevel.Critical, logger)); }
public static INDLogBuilder Info(this INDLogger logger) { if (!logger.IsEnabled(NDLogLevel.Information)) { return(NDNullLogBuilder.Instance); } return(new NDLogBuilder(NDLogLevel.Information, logger)); }
public static INDLogBuilder Warn(this INDLogger logger) { if (!logger.IsEnabled(NDLogLevel.Warning)) { return(NDNullLogBuilder.Instance); } return(new NDLogBuilder(NDLogLevel.Warning, logger)); }
public static INDLogBuilder Level(this INDLogger logger, NDLogLevel logLevel) { if (!logger.IsEnabled(logLevel)) { return(NDNullLogBuilder.Instance); } return(new NDLogBuilder(logLevel, logger)); }
public static void Info <T>(this INDLogger logger, T message, Exception exception, IFormatProvider formatter, params object[] args) where T : class { if (logger == null) { throw new ArgumentNullException(logger.ToString()); } logger.Log(NDLogLevel.Information, message, exception, formatter, args); }
public static bool RemoveFactory(string logCategory) { if (!factorys.ContainsKey(logCategory.ToString())) { return(false); } INDLogger logger = factorys[logCategory.ToString()].GetLogger(); loggerCollection.Remove(logger); return(true); }
public static void AddFactory(string logCategory, INDLoggerFactory provider) { if (factorys.ContainsKey(logCategory)) { throw new ArgumentException("添加重复键值:" + logCategory.ToString()); } factorys.Add(logCategory, provider); INDLogger logger = provider.CreateLogger(); if (logger != null) { loggerCollection.Add(logger); } }
public NDLogBuilder(NDLogLevel logLevel, INDLogger logger) { if (logger == null) { throw new ArgumentNullException(logger.ToString()); } _logger = logger; _data = new LogData { LogLevel = logLevel, FormatProvider = CultureInfo.InvariantCulture }; }
public static void Trace(this INDLogger logger, Exception exception, IFormatProvider formatter) { Trace(logger, "", exception, formatter, null); }
/// <summary> /// Formats and writes a debug log message. /// </summary> /// <param name="logger">The <see cref="INDLogger"/> to write to.</param> /// <param name="eventId">The event id associated with the log.</param> /// <param name="exception">The exception to log.</param> /// <param name="message">Format string of the log message.</param> /// <param name="args">An object array that contains zero or more objects to format.</param> public static void Trace <T>(this INDLogger logger, T message, Exception exception, params object[] args) where T : class { Trace(logger, message, exception, null, args); }
//------------------------------------------DEBUG------------------------------------------// /// <summary> /// Formats and writes a debug log message. /// </summary> /// <param name="logger">The <see cref="INDLogger"/> to write to.</param> /// <param name="eventId">The event id associated with the log.</param> /// <param name="message">Format string of the log message.</param> /// <param name="args">An object array that contains zero or more objects to format.</param> public static void Debug <T>(this INDLogger logger, T message, params object[] args) where T : class { Debug(logger, message, null, null, args); }
public static void Critical(this INDLogger logger, Exception exception, IFormatProvider formatter) { Critical(logger, "", exception, formatter, null); }
//------------------------------------------Error------------------------------------------// /// <summary> /// Formats and writes a debug log message. /// </summary> /// <param name="logger">The <see cref="INDLogger"/> to write to.</param> /// <param name="eventId">The event id associated with the log.</param> /// <param name="message">Format string of the log message.</param> /// <param name="args">An object array that contains zero or more objects to format.</param> public static void Critical <T>(this INDLogger logger, T message, params object[] args) where T : class { Critical(logger, message, null, null, args); }
//------------------------------------------Error------------------------------------------// /// <summary> /// Formats and writes a debug log message. /// </summary> /// <param name="logger">The <see cref="INDLogger"/> to write to.</param> /// <param name="eventId">The event id associated with the log.</param> /// <param name="message">Format string of the log message.</param> /// <param name="args">An object array that contains zero or more objects to format.</param> public static void Error <T>(this INDLogger logger, T message, params object[] args) where T : class { Error(logger, message, null, null, args); }