More datahandler stuff, removed SzOperationResult.cs and made a new SzResult.cs and changed Evaluator and DataHander to utilize it

This commit is contained in:
2026-01-29 11:30:35 -06:00
parent 5265ceb0da
commit 2e5263f302
9 changed files with 136 additions and 354 deletions

View File

@@ -5,21 +5,10 @@ namespace SzCli;
public class Logger : ISzLogger
{
private DefaultLocalFileManager _fileManager;
public bool LogToFile { get; set; } = true;
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}");
@@ -41,6 +30,16 @@ public class Logger : ISzLogger
private void AppendLogFile(string text)
{
// TODO: Make sure log file adheres to LogFileMaxLines
if (!File.Exists(LogFilePath))
{
LogFilePath = Path.Combine(SZ.LocalFileManager.DataPath, "log.txt");
AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
{
LogError($"[EXCEPTION] {eventArgs.Exception}");
};
}
File.AppendAllText(LogFilePath, text + "\n");
}
}