Example #1
0
        public void CreateLogger_Default_LoggerIsNotNull()
        {
            _factory.AddConsoleAdvanced();

            var logger = _factory.CreateLogger <LoggerFactoryTest>();

            Assert.NotNull(logger);
        }
 /// <summary>
 /// Adds a console logger that is enabled as defined by the filter function.
 /// </summary>
 /// <param name="factory"></param>
 /// <param name="filter"></param>
 public static ILoggerFactory AddConsoleAdvanced(
     this ILoggerFactory factory,
     Func <string, LogLevel, bool> filter)
 {
     factory.AddConsoleAdvanced(filter, ConsoleLoggerSettings.Optimized);
     return(factory);
 }
 /// <summary>
 /// Adds a console logger that is enabled for <see cref="LogLevel"/>s of minLevel or higher.
 /// </summary>
 /// <param name="factory">The <see cref="ILoggerFactory"/> to use.</param>
 /// <param name="minLevel">The minimum <see cref="LogLevel"/> to be logged</param>
 public static ILoggerFactory AddConsoleAdvanced(
     this ILoggerFactory factory,
     LogLevel minLevel)
 {
     factory.AddConsoleAdvanced(minLevel, ConsoleLoggerSettings.Optimized);
     return(factory);
 }
 /// <summary>
 /// Adds a console logger that is enabled for <see cref="LogLevel"/>.Information or higher.
 /// </summary>
 /// <param name="factory"></param>
 /// <param name="settings"></param>
 public static ILoggerFactory AddConsoleAdvanced(
     this ILoggerFactory factory,
     IConsoleLoggerSettings settings)
 {
     factory.AddConsoleAdvanced((n, l) => l >= LogLevel.Information, settings);
     return(factory);
 }
 /// <summary>
 /// Adds a console logger that is enabled for <see cref="LogLevel"/>s of minLevel or higher.
 /// </summary>
 /// <param name="factory"></param>
 /// <param name="minLevel">The minimum <see cref="LogLevel"/> to be logged</param>
 /// <param name="settings"></param>
 public static ILoggerFactory AddConsoleAdvanced(
     this ILoggerFactory factory,
     LogLevel minLevel,
     IConsoleLoggerSettings settings)
 {
     factory.AddConsoleAdvanced((category, logLevel) => logLevel >= minLevel, settings);
     return(factory);
 }
 /// <summary>
 /// Adds a console logger that is enabled for <see cref="LogLevel"/>.Information or higher.
 /// </summary>
 public static ILoggerFactory AddConsoleAdvanced(this ILoggerFactory factory)
 {
     return(factory.AddConsoleAdvanced(ConsoleLoggerSettings.Optimized));
 }