Very simple (and even naive) logger.
Ejemplo n.º 1
0
        private static void Main(string[] args)
        {
            var options = ParseCommandLineArgs(args);

            if (options == null)
            {
                return;
            }

            var configuration = ValidateOptions(options);

            if (configuration == null)
            {
                return;
            }

            CustomLogger.Configure(configuration.LogFile, configuration.LogEnabled);

            var runner = new AnalyzerRunner(configuration);

            runner.TryAnalyzeSolutionAsync().GetAwaiter().GetResult();

            Console.WriteLine("Press \"Enter\" to exit");
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        private static void LogConfiguration(Configuration configuration)
        {
            CustomLogger.WriteInfo($"Analyzing solution '{configuration.Solution}'.");
            WriteInfo($"Logging is {(configuration.LogEnabled ? "enabled" : "disabled")}", consoleOnly: true);
            if (configuration.LogEnabled)
            {
                WriteInfo($"Log file is '{configuration.LogFile}'", consoleOnly: true);
            }

            if (!configuration.Analyzers.IsEmpty)
            {
                WriteInfo($"Custom analyzers: {string.Join(", ", configuration.Analyzers.Select(a => a.FullName))}");
            }

            WriteInfo($"Info level diagnostics: {(configuration.RunInfoLevelDiagnostics ? "'on'" : "'off'")}");
            if (!configuration.SuppressedDiagnostics.IsEmpty)
            {
                WriteInfo($"Suppressed diagnostics: {string.Join(", ", configuration.SuppressedDiagnostics)}");
            }
        }