Beispiel #1
0
        private static string GetLoggerSettings(MSBuildLoggerSettings loggerSettings)
        {
            var settings = new List <string>();

            if (loggerSettings.PerformanceSummary)
            {
                settings.Add("PerformanceSummary");
            }

            if (loggerSettings.NoSummary)
            {
                settings.Add("NoSummary");
            }

            if (loggerSettings.SummaryOutputLevel != MSBuildLoggerOutputLevel.Default)
            {
                switch (loggerSettings.SummaryOutputLevel)
                {
                case MSBuildLoggerOutputLevel.WarningsOnly:
                    settings.Add("WarningsOnly");
                    break;

                case MSBuildLoggerOutputLevel.ErrorsOnly:
                    settings.Add("ErrorsOnly");
                    break;
                }
            }

            if (loggerSettings.HideItemAndPropertyList)
            {
                settings.Add("NoItemAndPropertyList");
            }

            if (loggerSettings.ShowCommandLine)
            {
                settings.Add("ShowCommandLine");
            }

            if (loggerSettings.ShowTimestamp)
            {
                settings.Add("ShowTimestamp");
            }

            if (loggerSettings.ShowEventId)
            {
                settings.Add("ShowEventId");
            }

            if (loggerSettings.ForceNoAlign)
            {
                settings.Add("ForceNoAlign");
            }

            if (loggerSettings.ConsoleColorType == MSBuildConsoleColorType.Disabled)
            {
                settings.Add("DisableConsoleColor");
            }

            if (loggerSettings.ConsoleColorType == MSBuildConsoleColorType.ForceAnsi)
            {
                settings.Add("ForceConsoleColor");
            }

            if (loggerSettings.DisableMultiprocessorLogging)
            {
                settings.Add("DisableMPLogging");
            }

            if (loggerSettings.Verbosity.HasValue)
            {
                settings.Add($"Verbosity={loggerSettings.Verbosity}");
            }

            return(string.Join(";", settings));
        }
        /// <summary>
        /// Sets the parameters for the console logger.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="consoleLoggerParameters">The console logger parameters to set.</param>
        /// <returns>The same <see cref="DotNetCoreMSBuildSettings"/> instance so that multiple calls can be chained.</returns>
        public static DotNetCoreMSBuildSettings SetConsoleLoggerSettings(this DotNetCoreMSBuildSettings settings, MSBuildLoggerSettings consoleLoggerParameters)
        {
            EnsureSettings(settings);

            settings.ConsoleLoggerSettings = consoleLoggerParameters ?? throw new ArgumentNullException(nameof(consoleLoggerParameters));

            return(settings);
        }
Beispiel #3
0
 /// <summary>
 /// Sets the parameters for the console logger.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="consoleLoggerParameters">The console logger parameters to set.</param>
 /// <returns>The same <see cref="DotNetCoreMSBuildSettings"/> instance so that multiple calls can be chained.</returns>
 public static DotNetCoreMSBuildSettings SetConsoleLoggerSettings(this DotNetCoreMSBuildSettings settings, MSBuildLoggerSettings consoleLoggerParameters)
 {
     return((DotNetCoreMSBuildSettings)DotNet.MSBuild.DotNetMSBuildSettingsExtensions.SetConsoleLoggerSettings(settings, consoleLoggerParameters));
 }