50 lines
1.3 KiB
C#
Raw Normal View History

2022-05-13 22:41:15 +01:00
using System;
2022-05-14 02:58:38 +01:00
using Spectre.Console;
2022-05-13 22:41:15 +01:00
2022-05-14 02:58:38 +01:00
namespace SPT_AKI_Installer.Aki.Helper
2022-05-13 22:41:15 +01:00
{
public static class LogHelper
{
2022-05-14 02:58:38 +01:00
private static void Log(string tag, string message, string foreground, string background = "black")
{
AnsiConsole.MarkupLine($"[{foreground} on {background}][[{tag}]]: {message.EscapeMarkup()}[/]");
}
2022-05-13 22:41:15 +01:00
/// <summary>
/// Outputs a string to console starting with [USER] with
/// Green text
2022-05-13 22:41:15 +01:00
/// </summary>
public static void User(string text)
{
2022-05-14 02:58:38 +01:00
Log("USER", text, "green");
2022-05-13 22:41:15 +01:00
}
/// <summary>
/// Outputs a string to console starting with [WARNING] with
/// Yellow text
2022-05-13 22:41:15 +01:00
/// </summary>
public static void Warning(string text)
{
2022-05-14 02:58:38 +01:00
Log("WARNING", text, "yellow");
2022-05-13 22:41:15 +01:00
}
/// <summary>
/// Outputs a string to console starting with [ERROR] with
/// Red text
2022-05-13 22:41:15 +01:00
/// </summary>
public static void Error(string text)
{
2022-05-14 02:58:38 +01:00
Log("ERROR", text, "red");
2022-05-13 22:41:15 +01:00
}
/// <summary>
/// Outputs a string to console starting with [INFO] with
/// Blue text
2022-05-13 22:41:15 +01:00
/// </summary>
public static void Info(string text)
{
2022-05-14 02:58:38 +01:00
Log("INFO", text, "blue");
2022-05-13 22:41:15 +01:00
}
}
}