rename the log to loginfo and create log debug

This commit is contained in:
atef 2023-06-30 10:27:14 +02:00
parent ca7d58ff0e
commit da38aa7b83
3 changed files with 12 additions and 5 deletions

View File

@ -187,7 +187,7 @@ public static class Controller
if (statusRecord.Battery.Eoc) if (statusRecord.Battery.Eoc)
{ {
"Batteries have reached EOC".Log(); "Batteries have reached EOC".LogInfo();
config.LastEoc = UnixTime.Now; config.LastEoc = UnixTime.Now;
return false; return false;
} }

View File

@ -10,11 +10,18 @@ public static class Logger
private const Int32 MaxLogFileCount = 1000; // TODO: move to settings private const Int32 MaxLogFileCount = 1000; // TODO: move to settings
private const String LogFilePath = "LogDirectory/log.txt"; // TODO: move to settings private const String LogFilePath = "LogDirectory/log.txt"; // TODO: move to settings
// ReSharper disable once InconsistentNaming
private static readonly ILogger _logger = new CustomLogger(LogFilePath, MaxFileSizeBytes, MaxLogFileCount); private static readonly ILogger _logger = new CustomLogger(LogFilePath, MaxFileSizeBytes, MaxLogFileCount);
public static T Log<T>(this T t) where T : notnull public static T LogInfo<T>(this T t) where T : notnull
{ {
// _logger.LogInformation(t.ToString()); // TODO: check warning _logger.LogInformation(t.ToString()); // TODO: check warning
return t;
}
public static T LogDebug<T>(this T t) where T : notnull
{
_logger.LogDebug(t.ToString()); // TODO: check warning
return t; return t;
} }
} }

View File

@ -18,7 +18,7 @@ public class RelaysDevice
} }
catch (Exception e) catch (Exception e)
{ {
$"Failed to read from {nameof(RelaysDevice)}\n{e}".Log(); $"Failed to read from {nameof(RelaysDevice)}\n{e}".LogInfo();
// TODO: log // TODO: log
return null; return null;
@ -33,7 +33,7 @@ public class RelaysDevice
} }
catch (Exception e) catch (Exception e)
{ {
$"Failed to write to {nameof(RelaysDevice)}\n{e}".Log(); $"Failed to write to {nameof(RelaysDevice)}\n{e}".LogInfo();
} }
} }
} }