2026-04-18 06:04:39 +01:00
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace GameCult.Logging
|
|
|
|
|
{
|
2026-04-18 13:01:24 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Writes log messages to the process console.
|
|
|
|
|
/// </summary>
|
2026-04-18 06:04:39 +01:00
|
|
|
public class ConsoleLogger : ILogger
|
|
|
|
|
{
|
2026-04-18 13:01:24 +01:00
|
|
|
/// <inheritdoc />
|
2026-04-18 06:04:39 +01:00
|
|
|
public void LogInfo(string message) => Console.WriteLine($"[INFO] {message}");
|
2026-04-18 13:01:24 +01:00
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
2026-04-18 06:04:39 +01:00
|
|
|
public void LogWarning(string message)
|
|
|
|
|
{
|
|
|
|
|
Console.ForegroundColor = ConsoleColor.Yellow;
|
|
|
|
|
Console.WriteLine($"[WARN] {message}"); Console.ResetColor();
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-18 13:01:24 +01:00
|
|
|
/// <inheritdoc />
|
2026-04-18 06:04:39 +01:00
|
|
|
public void LogError(string message)
|
|
|
|
|
{
|
|
|
|
|
Console.ForegroundColor = ConsoleColor.Red;
|
|
|
|
|
Console.WriteLine($"[ERROR] {message}"); Console.ResetColor();
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-18 13:01:24 +01:00
|
|
|
/// <inheritdoc />
|
2026-04-18 06:04:39 +01:00
|
|
|
public void LogDebug(string message)
|
|
|
|
|
{
|
|
|
|
|
if(Environment.GetEnvironmentVariable("NODEV") is not null) Console.WriteLine($"[DEBUG] {message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-04-18 13:01:24 +01:00
|
|
|
}
|