2
0
mirror of synced 2025-01-15 11:04:10 +00:00

47 lines
1.0 KiB
C#
Raw Normal View History

2023-09-13 09:12:18 +02:00
namespace Logging
{
public class LogPrefixer : ILog
{
private readonly ILog backingLog;
2024-03-27 08:41:18 +01:00
public LogPrefixer(ILog backingLog)
{
this.backingLog = backingLog;
}
2023-09-13 09:12:18 +02:00
public LogPrefixer(ILog backingLog, string prefix)
{
this.backingLog = backingLog;
2024-03-27 08:41:18 +01:00
Prefix = prefix;
2023-09-13 09:12:18 +02:00
}
2024-03-27 08:41:18 +01:00
public string Prefix { get; set; } = string.Empty;
2023-09-13 09:12:18 +02:00
public LogFile CreateSubfile(string ext = "log")
{
return backingLog.CreateSubfile(ext);
}
public void Debug(string message = "", int skipFrames = 0)
{
2024-03-27 08:41:18 +01:00
backingLog.Debug(Prefix + message, skipFrames);
2023-09-13 09:12:18 +02:00
}
public void Error(string message)
{
2024-03-27 08:41:18 +01:00
backingLog.Error(Prefix + message);
2023-09-13 09:12:18 +02:00
}
public void Log(string message)
{
2024-03-27 08:41:18 +01:00
backingLog.Log(Prefix + message);
2023-09-13 09:12:18 +02:00
}
2023-09-20 13:33:58 +02:00
public void AddStringReplace(string from, string to)
{
backingLog.AddStringReplace(from, to);
}
2023-09-13 09:12:18 +02:00
}
}