2023-09-21 10:33:09 +02:00
|
|
|
|
namespace Logging
|
|
|
|
|
|
{
|
|
|
|
|
|
public class LogSplitter : ILog
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly ILog[] targetLogs;
|
|
|
|
|
|
|
|
|
|
|
|
public LogSplitter(params ILog[] targetLogs)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.targetLogs = targetLogs;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void AddStringReplace(string from, string to)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnAll(l => l.AddStringReplace(from, to));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-09 15:55:58 +01:00
|
|
|
|
public LogFile CreateSubfile(string addName, string ext = "log")
|
2023-09-21 10:33:09 +02:00
|
|
|
|
{
|
2024-12-09 15:55:58 +01:00
|
|
|
|
return targetLogs.First().CreateSubfile(addName, ext);
|
2023-09-21 10:33:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Debug(string message = "", int skipFrames = 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnAll(l => l.Debug(message, skipFrames + 2));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Error(string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnAll(l => l.Error(message));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-22 12:25:37 +02:00
|
|
|
|
public string GetFullName()
|
|
|
|
|
|
{
|
|
|
|
|
|
return targetLogs.First().GetFullName();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-21 10:33:09 +02:00
|
|
|
|
public void Log(string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnAll(l => l.Log(message));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-22 12:25:37 +02:00
|
|
|
|
public void Raw(string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnAll(l => l.Raw(message));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-21 10:33:09 +02:00
|
|
|
|
private void OnAll(Action<ILog> action)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var t in targetLogs) action(t);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|