Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ClientApp/Forms/GameForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public GameForm(Client client, int gameId, string gameLevel)
InitializeComponent();

_client = client;
_logger = new ServerLoggerAdapter(client);
_logger = new ServerLoggerProxy(client);

this.HandleCreated += GameForm_HandleCreated;

Expand Down Expand Up @@ -718,5 +718,6 @@ private void SetGroupButtonBorders(int group)
}
}
}

}
}
52 changes: 52 additions & 0 deletions ClientApp/ServerLoggerProxy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using SharedLibrary.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClientApp
{
public class ServerLoggerProxy : ILoggerProxy
{
private readonly ServerLoggerAdapter _serverLogger;
private readonly Dictionary<string, int> _logCounts;

public ServerLoggerProxy(Client client)
{
_serverLogger = new ServerLoggerAdapter(client);
_logCounts = new Dictionary<string, int>
{
{"Info",0 },
{"Warning",0 },
{"Error",0 }
};
}

public void LogInfo(string message)
{
_logCounts["Info"]++;
_serverLogger.LogInfo(message);

}

public void LogWarning(string message)
{
_logCounts["Warning"]++;
_serverLogger.LogWarning(message);
}

public void LogError(string message)
{
_logCounts["Error"]++;
_serverLogger.LogError(message);
}

public Dictionary<string,int> GetLogCounts()
{
return new Dictionary<string, int>(_logCounts);
}


}
}
14 changes: 14 additions & 0 deletions SharedLibrary/Interfaces/ILoggerProxy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SharedLibrary.Interfaces
{
public interface ILoggerProxy : ILogger
{
Dictionary<string, int> GetLogCounts();

}
}