Work on the datta handler

This commit is contained in:
2026-01-25 23:31:02 -06:00
parent 6d92e3993b
commit 5bde8db8cf
9 changed files with 116 additions and 49 deletions

View File

@@ -1,13 +1,25 @@
using SzCore;
using SzCore.Defaults;
namespace SzCli;
public class Logger(ISzFileManager fileManager) : ISzLogger
public class Logger : ISzLogger
{
private DefaultLocalFileManager _fileManager;
public bool LogToFile { get; set; } = true;
public string LogFilePath { get; set; } = Path.Combine(fileManager.DataPath, "log.txt");
public string LogFilePath { get; set; }
public int LogFileMaxLines { get; set; } = 100;
public Logger(DefaultLocalFileManager fm)
{
_fileManager = fm;
LogFilePath = Path.Combine(_fileManager.DataPath, "log.txt");
AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
{
LogError($"[EXCEPTION] {eventArgs.Exception}");
};
}
public void Log(string text)
{
Console.WriteLine($"{DateTime.UtcNow} : [SZ LOG] {text}");