Log time from build start instead of absolute time

This commit is contained in:
Pavel Krymets 2016-02-17 12:10:21 -08:00
parent 2deb093642
commit d35a384d2d

View file

@ -4,9 +4,12 @@ namespace Microsoft.DotNet.Cli.Build.Framework
{
public static class BuildReporter
{
private const string TimeSpanFormat = @"hh\:mm\:ss\.fff";
private static DateTime _initialTime = DateTime.Now;
public static void BeginSection(string type, string name)
{
Reporter.Output.WriteLine($"[{type.PadRight(10)} >]".Green() + $" [....] [{DateTime.Now:O}]".Blue() + $" {name}");
Reporter.Output.WriteLine($"[{type.PadRight(10)} >]".Green() + $" [....] [{(DateTime.Now - _initialTime).ToString(TimeSpanFormat)}]".Blue() + $" {name}");
}
public static void EndSection(string type, string name, bool success)
@ -21,7 +24,7 @@ namespace Microsoft.DotNet.Cli.Build.Framework
header = header.Red();
}
var successString = success ? " OK " : "FAIL";
Reporter.Output.WriteLine(header + $" [{successString}] [{DateTime.Now:O}]".Blue() + $" {name}");
Reporter.Output.WriteLine(header + $" [{successString}] [{(DateTime.Now - _initialTime).ToString(TimeSpanFormat)}]".Blue() + $" {name}");
}
}
}