示例#1
0
        /// <summary>
        /// Logs detailed information about this invocation,
        /// in the event that errors were detected.
        /// </summary>
        /// <returns>A Boolean indicating whether to proceed with extraction.</returns>
        public void LogDiagnostics()
        {
            foreach (var error in FilteredDiagnostics)
            {
                Logger.Log(Severity.Error, "  Compilation error: {0}", error);
            }

            if (FilteredDiagnostics.Any())
            {
                foreach (var reference in compilation.References)
                {
                    Logger.Log(Severity.Info, "  Resolved reference {0}", reference.Display);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Logs detailed information about this invocation,
        /// in the event that errors were detected.
        /// </summary>
        /// <param name="roslynArgs">The arguments passed to Roslyn.</param>
        public void LogDiagnostics(string[] roslynArgs)
        {
            Logger.Log(Severity.Info, "  Extractor: {0}", Environment.GetCommandLineArgs().First());
            if (extractor != null)
            {
                Logger.Log(Severity.Info, "  Extractor version: {0}", extractor.Version);
            }

            Logger.Log(Severity.Info, "  Current working directory: {0}", Directory.GetCurrentDirectory());

            if (roslynArgs != null)
            {
                Logger.Log(Severity.Info, $"  Arguments to Roslyn: {string.Join(' ', roslynArgs)}");

                // Create a new file in the log folder.
                var argsFile = Path.Combine(Extractor.GetCSharpLogDirectory(), $"csharp.{Path.GetRandomFileName()}.txt");

                if (roslynArgs.ArchiveCommandLine(argsFile))
                {
                    Logger.Log(Severity.Info, $"  Arguments have been written to {argsFile}");
                }
            }

            foreach (var error in FilteredDiagnostics)
            {
                Logger.Log(Severity.Error, "  Compilation error: {0}", error);
            }

            if (FilteredDiagnostics.Any())
            {
                foreach (var reference in compilation.References)
                {
                    Logger.Log(Severity.Info, "  Resolved reference {0}", reference.Display);
                }
            }
        }