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:
@@ -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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user