Fix actual log function not handling exceptions

Closes #252
This commit is contained in:
jvyden 2022-03-26 17:27:43 -04:00
commit a799505c78
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -25,6 +25,8 @@ public static class InfluxHelper
};
public static async void Log()
{
try
{
using WriteApi writeApi = Client.GetWriteApi();
PointData point = PointData.Measurement("lighthouse")
@ -44,6 +46,13 @@ public static class InfluxHelper
writeApi.Flush();
}
catch(Exception e)
{
Logger.Log("Exception while logging: ", LoggerLevelInflux.Instance);
foreach (string line in e.ToString().Split("\n")) Logger.Log(line, LoggerLevelInflux.Instance);
}
}
public static async Task StartLogging()
{
@ -61,7 +70,7 @@ public static class InfluxHelper
}
catch(Exception e)
{
Logger.Log("Exception while logging: ", LoggerLevelInflux.Instance);
Logger.Log("Exception while running log thread: ", LoggerLevelInflux.Instance);
foreach (string line in e.ToString().Split("\n")) Logger.Log(line, LoggerLevelInflux.Instance);
}