diff --git a/src/chocolatey/infrastructure/adapters/Console.cs b/src/chocolatey/infrastructure/adapters/Console.cs index 4bff68365b..ef1492b876 100644 --- a/src/chocolatey/infrastructure/adapters/Console.cs +++ b/src/chocolatey/infrastructure/adapters/Console.cs @@ -19,6 +19,11 @@ namespace chocolatey.infrastructure.adapters public sealed class Console : IConsole { + public void Write(string value) + { + System.Console.Write(value); + } + public string ReadLine() { return System.Console.ReadLine(); diff --git a/src/chocolatey/infrastructure/adapters/IConsole.cs b/src/chocolatey/infrastructure/adapters/IConsole.cs index 4649af2097..5a5c90d2cf 100644 --- a/src/chocolatey/infrastructure/adapters/IConsole.cs +++ b/src/chocolatey/infrastructure/adapters/IConsole.cs @@ -21,6 +21,12 @@ namespace chocolatey.infrastructure.adapters public interface IConsole { + /// + /// Writes the specified string value to the standard output stream. + /// + /// The value to write. An I/O error occurred. 1 + void Write(string value); + /// /// Reads the next line of characters from the standard input stream. /// diff --git a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs index a8b2394944..ddb3688baf 100644 --- a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs +++ b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs @@ -55,10 +55,13 @@ public static string prompt_for_confirmation_short(string prompt, IEnumerable c.Select(entry => entry.FirstOrDefault()).Distinct().Count() == c.Count(), (name, value) => { throw new ApplicationException("Multiple choices have the same first letter. Please ensure you pass choices with different first letters."); }); - "chocolatey".Log().Info(ChocolateyLoggers.Important, "{0} ({1}): ".format_with(prompt, String.Join("/", choices))); - + var promptWithChoices = "{0} ({1}): ".format_with(prompt, String.Join("/", choices)); + + Console.Write(promptWithChoices); var selection = Console.ReadLine(); + "chocolatey".Log().Info(ChocolateyLoggers.LogFileOnly, "{0}{1}".format_with(promptWithChoices, selection)); + // check to see if value was passed foreach (var choice in choices) { diff --git a/src/chocolatey/infrastructure/logging/ChocolateyLoggers.cs b/src/chocolatey/infrastructure/logging/ChocolateyLoggers.cs index dbd59b4de6..6e7deffde9 100644 --- a/src/chocolatey/infrastructure/logging/ChocolateyLoggers.cs +++ b/src/chocolatey/infrastructure/logging/ChocolateyLoggers.cs @@ -20,5 +20,7 @@ public enum ChocolateyLoggers Normal, Verbose, Important, + // Used to output prompt results in log file, but not in the console + LogFileOnly, } } \ No newline at end of file diff --git a/src/chocolatey/infrastructure/logging/log4net.config.xml b/src/chocolatey/infrastructure/logging/log4net.config.xml index a377f8c169..3bd240a1bf 100644 --- a/src/chocolatey/infrastructure/logging/log4net.config.xml +++ b/src/chocolatey/infrastructure/logging/log4net.config.xml @@ -111,6 +111,10 @@ + + + +