public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            IConfiguration config        = null;
            LogLevel       level         = LogLevel.Critical;
            bool           includeScopes = false;
            Func <string, Microsoft.Extensions.Logging.LogLevel, bool> filter = null;

            Microsoft.Extensions.Logging.Console.IConsoleLoggerSettings consoleSettings = null;
            Microsoft.Extensions.Logging.AzureAppServices.AzureAppServicesDiagnosticsSettings azureSettings = null;
            Microsoft.Extensions.Logging.EventLog.EventLogSettings eventLogSettings = null;

            // An issue will be raised for each call to an ILoggerFactory extension methods adding loggers.
            loggerFactory.AddAzureWebAppDiagnostics();
//          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^    {{Make sure that this logger's configuration is safe.}}
            loggerFactory.AddAzureWebAppDiagnostics(azureSettings); // Noncompliant
            loggerFactory.AddConsole();                             // Noncompliant
            loggerFactory.AddConsole(level);                        // Noncompliant
            loggerFactory.AddConsole(level, includeScopes);         // Noncompliant
            loggerFactory.AddConsole(filter);                       // Noncompliant
            loggerFactory.AddConsole(filter, includeScopes);        // Noncompliant
            loggerFactory.AddConsole(config);                       // Noncompliant
            loggerFactory.AddConsole(consoleSettings);              // Noncompliant
            loggerFactory.AddDebug();                               // Noncompliant
            loggerFactory.AddDebug(level);                          // Noncompliant
            loggerFactory.AddDebug(filter);                         // Noncompliant
            loggerFactory.AddEventLog();                            // Noncompliant
            loggerFactory.AddEventLog(eventLogSettings);            // Noncompliant
            loggerFactory.AddEventLog(level);                       // Noncompliant
//          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^    {{Make sure that this logger's configuration is safe.}}

            // Testing the next method using a hack - see notes at the end of the file
            loggerFactory.AddEventSourceLogger(); // Noncompliant

            IEnumerable <ILoggerProvider>         providers      = null;
            LoggerFilterOptions                   filterOptions1 = null;
            IOptionsMonitor <LoggerFilterOptions> filterOptions2 = null;

            LoggerFactory factory = new LoggerFactory(); // Noncompliant

//                                  ^^^^^^^^^^^^^^^^^^^    {{Make sure that this logger's configuration is safe.}}

            new LoggerFactory(providers);                 // Noncompliant
            new LoggerFactory(providers, filterOptions1); // Noncompliant
            new LoggerFactory(providers, filterOptions2); // Noncompliant
        }
Beispiel #2
0
 public EventLogLoggerProvider(Microsoft.Extensions.Logging.EventLog.EventLogSettings settings)
 {
 }
Beispiel #3
0
 public static Microsoft.Extensions.Logging.ILoggingBuilder AddEventLog(this Microsoft.Extensions.Logging.ILoggingBuilder builder, Microsoft.Extensions.Logging.EventLog.EventLogSettings settings)
 {
     throw null;
 }