ResourceManager!

This commit is contained in:
2023-06-18 22:16:28 +02:00
parent c0bdb3d4a6
commit 2fb5125ece
9 changed files with 215 additions and 22 deletions

View File

@@ -0,0 +1,47 @@
namespace DaggerFramework.Utils
{
public class Logger
{
public static Action<string, LogType>? OnLog;
public Logger(string className)
{
_className = className;
}
public void Info(object what)
{
LogType logType = LogType.Info;
string message = $"({DateFormat}) [{logType.ToString().ToUpper()}/{_className}] {what}";
LogConsole(message);
OnLog?.Invoke(message, logType);
}
public void Warn(object what)
{
LogType logType = LogType.Warn;
string message = $"({DateFormat}) [{logType.ToString().ToUpper()}/{_className}] {what}";
LogConsole(message);
OnLog?.Invoke(message, logType);
}
public void Error(object what)
{
LogType logType = LogType.Error;
string message = $"({DateFormat}) [{logType.ToString().ToUpper()}/{_className}] {what}";
LogConsole(message);
OnLog?.Invoke(message, logType);
}
private static string DateFormat => $"{DateTime.Now:t}";
private static void LogConsole(string what) => Console.WriteLine(what);
private readonly string _className;
}
public enum LogType
{
Info,
Warn,
Error
}
}