Add adjudicator logger
This commit is contained in:
parent
46c28a087c
commit
23a826c815
|
@ -0,0 +1,13 @@
|
|||
namespace MultiversalDiplomacy.Adjudicate.Logging;
|
||||
|
||||
public class ConsoleLogger : IAdjudicatorLogger
|
||||
{
|
||||
public static ConsoleLogger Instance { get; } = new();
|
||||
|
||||
public void Log(int contextLevel, string message, params object[] args)
|
||||
{
|
||||
string spacing = string.Format($"{{0,{2 * contextLevel}}}", string.Empty);
|
||||
string formattedMessage = string.Format(message, args);
|
||||
Console.WriteLine(spacing + formattedMessage);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
namespace MultiversalDiplomacy.Adjudicate.Logging;
|
||||
|
||||
public interface IAdjudicatorLogger
|
||||
{
|
||||
public void Log(int contextLevel, string message, params object[] args);
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.ObjectModel;
|
||||
|
||||
using MultiversalDiplomacy.Adjudicate.Decision;
|
||||
using MultiversalDiplomacy.Adjudicate.Logging;
|
||||
using MultiversalDiplomacy.Model;
|
||||
using MultiversalDiplomacy.Orders;
|
||||
|
||||
|
@ -11,7 +12,14 @@ namespace MultiversalDiplomacy.Adjudicate;
|
|||
/// </summary>
|
||||
public class MovementPhaseAdjudicator : IPhaseAdjudicator
|
||||
{
|
||||
public static IPhaseAdjudicator Instance { get; } = new MovementPhaseAdjudicator();
|
||||
public static IPhaseAdjudicator Instance { get; } = new MovementPhaseAdjudicator(ConsoleLogger.Instance);
|
||||
|
||||
private IAdjudicatorLogger logger { get; }
|
||||
|
||||
public MovementPhaseAdjudicator(IAdjudicatorLogger logger)
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public List<OrderValidation> ValidateOrders(World world, List<Order> orders)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue