forked from beerpsi/Rizu
58 lines
1.4 KiB
C#
58 lines
1.4 KiB
C#
using System.Diagnostics;
|
|
using JetBrains.Annotations;
|
|
|
|
namespace Rizu.Core;
|
|
|
|
// UnityEngine.Debug logs don't show up in BepInEx logs for some reason
|
|
public static class Logger
|
|
{
|
|
private static readonly string LogPrefix = "[Rizu]";
|
|
|
|
[Conditional("DEBUG")]
|
|
public static void Debug(string msg)
|
|
{
|
|
Log("DEBUG", msg);
|
|
}
|
|
|
|
[Conditional("DEBUG")]
|
|
[StringFormatMethod("format")]
|
|
public static void Debug(string format, params object[] args)
|
|
{
|
|
Log("DEBUG", format, args);
|
|
}
|
|
|
|
public static void Info(string msg)
|
|
{
|
|
Log("INFO", msg);
|
|
}
|
|
|
|
[StringFormatMethod("format")]
|
|
public static void Info(string format, params object[] args)
|
|
{
|
|
Log("INFO", format, args);
|
|
}
|
|
|
|
public static void Error(string msg)
|
|
{
|
|
Log("ERROR", msg);
|
|
}
|
|
|
|
[StringFormatMethod("format")]
|
|
public static void Error(string format, params object[] args)
|
|
{
|
|
Log("ERROR", format, args);
|
|
}
|
|
|
|
private static void Log(string level, string msg)
|
|
{
|
|
|
|
System.Console.WriteLine($"{LogPrefix} [{level}] {msg}");
|
|
}
|
|
|
|
[StringFormatMethod("format")]
|
|
private static void Log(string level, string format, params object[] args)
|
|
{
|
|
System.Console.WriteLine($"{LogPrefix} [{level}] {format}", args);
|
|
}
|
|
}
|