PkmnLibSharp/PkmnLibSharp/Battling/LogHandler.cs

30 lines
707 B
C#
Raw Normal View History

2020-08-14 14:15:19 +00:00
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);
}
}
}
}