Merge pull request #1455 from dotnet/pakrym/timespan
Log time from build start instead of absolute time
This commit is contained in:
commit
6f0e52376e
1 changed files with 5 additions and 2 deletions
|
@ -4,9 +4,12 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
{
|
{
|
||||||
public static class BuildReporter
|
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)
|
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)
|
public static void EndSection(string type, string name, bool success)
|
||||||
|
@ -21,7 +24,7 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
header = header.Red();
|
header = header.Red();
|
||||||
}
|
}
|
||||||
var successString = success ? " OK " : "FAIL";
|
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}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue