2021-11-23 13:01:42 +00:00
|
|
|
|
namespace Common;
|
2021-08-24 12:07:09 +01:00
|
|
|
|
|
2021-11-23 13:01:42 +00:00
|
|
|
|
public static class LoggingHelpers
|
2021-08-24 12:07:09 +01:00
|
|
|
|
{
|
2021-11-23 13:01:42 +00:00
|
|
|
|
public static string LogTimeTaken(double totalSeconds)
|
2021-08-24 12:07:09 +01:00
|
|
|
|
{
|
2021-11-23 13:01:42 +00:00
|
|
|
|
return Math.Round(totalSeconds, 2, MidpointRounding.ToEven).ToString();
|
|
|
|
|
}
|
2021-08-24 12:07:09 +01:00
|
|
|
|
|
2021-11-23 13:01:42 +00:00
|
|
|
|
public static void LogToConsole(string message, ConsoleColor backgroundColour = ConsoleColor.Green)
|
|
|
|
|
{
|
|
|
|
|
Console.BackgroundColor = backgroundColour;
|
|
|
|
|
Console.ForegroundColor = ConsoleColor.Black;
|
2021-08-24 12:07:09 +01:00
|
|
|
|
|
2021-11-23 13:01:42 +00:00
|
|
|
|
Console.Write(message);
|
|
|
|
|
ResetConsoleColours();
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
}
|
2021-08-24 12:07:09 +01:00
|
|
|
|
|
2021-11-23 13:01:42 +00:00
|
|
|
|
private static void ResetConsoleColours()
|
|
|
|
|
{
|
|
|
|
|
Console.BackgroundColor = ConsoleColor.Black;
|
|
|
|
|
Console.ForegroundColor = ConsoleColor.White;
|
2021-08-24 12:07:09 +01:00
|
|
|
|
}
|
|
|
|
|
}
|