Fix N00BS

This commit is contained in:
Li 2022-07-19 12:33:44 +12:00
parent 0c299729dd
commit b3df338715
15 changed files with 71 additions and 81 deletions

View file

@ -48,14 +48,17 @@ namespace HISP.Cli
}
public static void LogToFile(bool error, string type,string text)
{
sw.WriteLineAsync(text + sw.NewLine);
sw.WriteLineAsync(DateTime.Now.ToString("MM-dd-YYYY HH:mm:dd") + ": [" + type + "] " + text + sw.NewLine);
}
public static void LogStdout(bool error, string type, string text)
{
if (type == "CRASH")
LogToFile(error, type, text);
if (error)
Console.Error.WriteAsync("[" + type + "] " + text + Console.Error.NewLine);
Console.Error.WriteAsync(DateTime.Now.ToString("MM-dd-YYYY HH:mm:dd")+": [" + type + "] " + text + Console.Error.NewLine);
else
Console.Out.WriteAsync("[" + type + "] " + text + Console.Out.NewLine);
Console.Out.WriteAsync(DateTime.Now.ToString("MM-dd-YYYY HH:mm:dd") + ": [" + type + "] " + text + Console.Out.NewLine);
}
@ -120,6 +123,10 @@ namespace HISP.Cli
LogFile = HispLogVar;
Logger.SetCallback(LogToFile);
}
else
{
LogFile = Path.Combine(BaseDir, "crash.log");
}
if (HispBaseDir != null)
{