refactor logging in pretty big overhaul

This commit is contained in:
RaidMax
2020-11-11 17:31:26 -06:00
parent fd7bd7e0da
commit 570a228c92
86 changed files with 1603 additions and 1534 deletions

View File

@ -8,14 +8,19 @@ using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using static SharedLibraryCore.Server;
using ILogger = Microsoft.Extensions.Logging.ILogger;
namespace IW4MAdmin.Application.RconParsers
{
public class BaseRConParser : IRConParser
{
public BaseRConParser(IParserRegexFactory parserRegexFactory)
private readonly ILogger _logger;
public BaseRConParser(ILogger<BaseRConParser> logger, IParserRegexFactory parserRegexFactory)
{
_logger = logger;
Configuration = new DynamicRConParserConfiguration(parserRegexFactory)
{
CommandPrefixes = new CommandPrefix()
@ -133,12 +138,7 @@ namespace IW4MAdmin.Application.RconParsers
public virtual async Task<(List<EFClient>, string, string)> GetStatusAsync(IRConConnection connection)
{
string[] response = await connection.SendQueryAsync(StaticHelpers.QueryType.COMMAND_STATUS);
#if DEBUG
foreach (var line in response)
{
Console.WriteLine(line);
}
#endif
_logger.LogDebug("Status Response {@response}", (object)response);
return (ClientsFromStatus(response), MapFromStatus(response), GameTypeFromStatus(response));
}