2016-02-02 18:04:50 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli.Build.Framework
|
|
|
|
|
{
|
|
|
|
|
public static class BuildReporter
|
|
|
|
|
{
|
2016-02-17 20:10:21 +00:00
|
|
|
|
private const string TimeSpanFormat = @"hh\:mm\:ss\.fff";
|
|
|
|
|
private static DateTime _initialTime = DateTime.Now;
|
|
|
|
|
|
2016-02-02 18:04:50 +00:00
|
|
|
|
public static void BeginSection(string type, string name)
|
|
|
|
|
{
|
2016-02-17 20:10:21 +00:00
|
|
|
|
Reporter.Output.WriteLine($"[{type.PadRight(10)} >]".Green() + $" [....] [{(DateTime.Now - _initialTime).ToString(TimeSpanFormat)}]".Blue() + $" {name}");
|
2016-02-02 18:04:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void EndSection(string type, string name, bool success)
|
|
|
|
|
{
|
|
|
|
|
var header = $"[{type.PadRight(10)} <]";
|
|
|
|
|
if(success)
|
|
|
|
|
{
|
|
|
|
|
header = header.Green();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
header = header.Red();
|
|
|
|
|
}
|
|
|
|
|
var successString = success ? " OK " : "FAIL";
|
2016-02-17 20:10:21 +00:00
|
|
|
|
Reporter.Output.WriteLine(header + $" [{successString}] [{(DateTime.Now - _initialTime).ToString(TimeSpanFormat)}]".Blue() + $" {name}");
|
2016-02-02 18:04:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|