You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
using System.Text.RegularExpressions;
|
|
using EpicGames.Core;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Horde.Agent.Parser
|
|
{
|
|
/// <summary>
|
|
/// Turns raw text output into structured logging events
|
|
/// </summary>
|
|
public class LogParser : LogEventParser
|
|
{
|
|
/// <summary>
|
|
/// Constructor
|
|
/// </summary>
|
|
/// <param name="logger">The logger to receive parsed output messages</param>
|
|
/// <param name="ignorePatterns">List of patterns to ignore</param>
|
|
public LogParser(ILogger logger, List<string> ignorePatterns)
|
|
: base(logger)
|
|
{
|
|
foreach (string ignorePattern in ignorePatterns)
|
|
{
|
|
IgnorePatterns.Add(new Regex(ignorePattern, RegexOptions.Compiled));
|
|
}
|
|
|
|
foreach (Type type in Assembly.GetExecutingAssembly().GetTypes())
|
|
{
|
|
if (type.IsClass && typeof(ILogEventMatcher).IsAssignableFrom(type))
|
|
{
|
|
ILogEventMatcher matcher = (ILogEventMatcher)Activator.CreateInstance(type)!;
|
|
Matchers.Add(matcher);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Static constructor
|
|
/// </summary>
|
|
static LogParser()
|
|
{
|
|
System.Text.RegularExpressions.Regex.CacheSize = 1000;
|
|
}
|
|
}
|
|
}
|