30 lines
707 B
C#
30 lines
707 B
C#
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace PkmnLibSharp.Battling
|
||
|
{
|
||
|
public static class LogHandler
|
||
|
{
|
||
|
private static readonly List<Action<LogLevel, string>> Listeners = new List<Action<LogLevel, string>>();
|
||
|
|
||
|
public enum LogLevel
|
||
|
{
|
||
|
Information,
|
||
|
Warning,
|
||
|
Error
|
||
|
}
|
||
|
|
||
|
public static void RegisterListener(Action<LogLevel, string> listener)
|
||
|
{
|
||
|
Listeners.Add(listener);
|
||
|
}
|
||
|
|
||
|
internal static void Log(LogLevel level, string message)
|
||
|
{
|
||
|
foreach (var listener in Listeners)
|
||
|
{
|
||
|
listener(level, message);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|