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