Reorganize project structure

This commit is contained in:
Stone_Red
2026-06-19 00:56:46 +02:00
parent 6f58eefb66
commit 95d88f1a8d
84 changed files with 267 additions and 186 deletions
+34
View File
@@ -0,0 +1,34 @@
using System.Collections.Concurrent;
namespace RemSox.Kernel.Logging;
public class InMemoryLogger : ILogger
{
private readonly ConcurrentBag<LogEntry> logs = [];
public void Log(string message, LogSeverity severity)
{
logs.Add(new LogEntry(message, severity, DateTimeOffset.UtcNow));
}
public void LogError(string message)
{
Log(message, LogSeverity.Error);
}
public void LogInfo(string message)
{
Log(message, LogSeverity.Info);
}
public void LogWarning(string message)
{
Log(message, LogSeverity.Warning);
}
public IEnumerable<LogEntry> GetLogs(int? count = null)
{
IEnumerable<LogEntry> orderedLogs = logs.OrderBy(l => l.Timestamp);
return count.HasValue ? orderedLogs.TakeLast(count.Value) : orderedLogs;
}
}