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);
        }
Exemple #7
0
        public static bool RemoveFactory(string logCategory)
        {
            if (!factorys.ContainsKey(logCategory.ToString()))
            {
                return(false);
            }
            INDLogger logger = factorys[logCategory.ToString()].GetLogger();

            loggerCollection.Remove(logger);
            return(true);
        }
Exemple #8
0
        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
            };
        }
Exemple #10
0
 public static void Trace(this INDLogger logger, Exception exception, IFormatProvider formatter)
 {
     Trace(logger, "", exception, formatter, null);
 }
Exemple #11
0
 /// <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);
 }
Exemple #12
0
 //------------------------------------------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);
 }
Exemple #13
0
 public static void Critical(this INDLogger logger, Exception exception, IFormatProvider formatter)
 {
     Critical(logger, "", exception, formatter, null);
 }
Exemple #14
0
 //------------------------------------------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);
 }
Exemple #15
0
 //------------------------------------------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);
 }