Skip to content

Commit 2a25720

Browse files
author
Jake Ginnivan
committed
Write to console when output type is BuildServer. Fixes #158
1 parent 110f2e5 commit 2a25720

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

GitVersionExe/Program.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ static IEnumerable<IBuildServer> GetApplicableBuildServers(Arguments arguments)
142142

143143
static void ConfigureLogging(Arguments arguments)
144144
{
145-
Action<string> writeAction = x => { };
145+
var writeActions = new List<Action<string>>();
146146

147-
if (arguments.LogFilePath == "console")
147+
if (arguments.LogFilePath == "console" || arguments.Output == OutputType.BuildServer)
148148
{
149-
writeAction = Console.WriteLine;
149+
writeActions.Add(Console.WriteLine);
150150
}
151151
else if (arguments.LogFilePath != null)
152152
{
@@ -158,17 +158,17 @@ static void ConfigureLogging(Arguments arguments)
158158
using (File.CreateText(arguments.LogFilePath)) { }
159159
}
160160

161-
writeAction = x => WriteLogEntry(arguments, x);
161+
writeActions.Add(x => WriteLogEntry(arguments, x));
162162
}
163163
catch (Exception ex)
164164
{
165165
Console.WriteLine("Failed to configure logging: " + ex.Message);
166166
}
167167
}
168168

169-
Logger.WriteInfo = writeAction;
170-
Logger.WriteWarning = writeAction;
171-
Logger.WriteError = writeAction;
169+
Logger.WriteInfo = s => writeActions.ForEach(a => a(s));
170+
Logger.WriteWarning = s => writeActions.ForEach(a => a(s));
171+
Logger.WriteError = s => writeActions.ForEach(a => a(s));
172172
}
173173

174174
static void WriteLogEntry(Arguments arguments, string s)

0 commit comments

Comments
 (0)