2022-05-14 02:58:38 +01:00

50 lines
1.4 KiB
C#

using System;
using Spectre.Console;
namespace SPT_AKI_Installer.Aki.Helper
{
public static class LogHelper
{
private static void Log(string tag, string message, string foreground, string background = "black")
{
AnsiConsole.MarkupLine($"[{foreground} on {background}][[{tag}]]: {message.EscapeMarkup()}[/]");
}
/// <summary>
/// Outputs a string to console starting with [USER] with
/// a Green background and Black foreground
/// </summary>
public static void User(string text)
{
Log("USER", text, "green");
}
/// <summary>
/// Outputs a string to console starting with [WARNING] with
/// a Yellow background and Black foreground
/// </summary>
public static void Warning(string text)
{
Log("WARNING", text, "yellow");
}
/// <summary>
/// Outputs a string to console starting with [ERROR] with
/// a Red background and Black foreground
/// </summary>
public static void Error(string text)
{
Log("ERROR", text, "red");
}
/// <summary>
/// Outputs a string to console starting with [INFO] with
/// a DarkGray background and White foreground
/// </summary>
public static void Info(string text)
{
Log("INFO", text, "blue");
}
}
}