-
Notifications
You must be signed in to change notification settings - Fork 0
/
Logger.cs
36 lines (31 loc) · 1.14 KB
/
Logger.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using Spectre.Console;
namespace chihuahua {
internal static class Logger {
public static bool verbose = false;
public sealed class ErrorSpinner : Spinner {
public override TimeSpan Interval => TimeSpan.FromMilliseconds(250);
public override bool IsUnicode => false;
public override IReadOnlyList<string> Frames => [" E", " ER", "ERR", "RRO", "OR ", "R "];
}
public static void Log(string prefix, string message) {
AnsiConsole.MarkupLine(prefix + message);
}
public static void Debug(string message) {
if (verbose) {
Log("[dim]DEBUG: [/]", $"[gray]{message}[/]");
}
}
public static void Info(string message) {
Log("[white] INFO: [/]", message);
}
public static void Warn(string message) {
Log("[yellow] WARN: [/]", message);
}
public static void Error(string message) {
Log("[red]ERROR: [/]", message);
}
public static void Fatal(string message) {
Log("[magenta]FATAL: [/]", message);
}
}
}