diff --git a/NucuCar.Domain/Telemetry/TelemetryPublisher.cs b/NucuCar.Domain/Telemetry/TelemetryPublisher.cs index b333e8f..4a32b87 100644 --- a/NucuCar.Domain/Telemetry/TelemetryPublisher.cs +++ b/NucuCar.Domain/Telemetry/TelemetryPublisher.cs @@ -61,6 +61,7 @@ namespace NucuCar.Domain.Telemetry public bool RegisterTelemeter(ITelemeter t) { if (RegisteredTelemeters.Contains(t)) return false; + Logger.LogDebug($"Registering telemeter {t.GetIdentifier()}"); RegisteredTelemeters.Add(t); return true; } @@ -73,6 +74,7 @@ namespace NucuCar.Domain.Telemetry public bool UnRegisterTelemeter(ITelemeter t) { if (!RegisteredTelemeters.Contains(t)) return false; + Logger.LogDebug($"UnRegistering telemeter {t.GetIdentifier()}"); RegisteredTelemeters.Remove(t); return true; } diff --git a/NucuCar.Sensors/Health/CpuTempSensor.cs b/NucuCar.Sensors/Health/CpuTempSensor.cs index 63561b3..f0b1dab 100644 --- a/NucuCar.Sensors/Health/CpuTempSensor.cs +++ b/NucuCar.Sensors/Health/CpuTempSensor.cs @@ -1,6 +1,8 @@ +using System; using System.Collections.Generic; using System.Threading.Tasks; using Iot.Device.CpuTemperature; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Newtonsoft.Json; using NucuCar.Domain.Sensors; @@ -52,7 +54,8 @@ namespace NucuCar.Sensors.Health _lastTemperatureCelsius = double.NaN; } } - + Logger?.LogDebug($"{DateTimeOffset.Now}:HealthSensor: reading"); + Logger.LogInformation($"CPU Temperature ${_lastTemperatureCelsius}"); return Task.FromResult(_lastTemperatureCelsius); } diff --git a/NucuCar.Sensors/SensorWorker.cs b/NucuCar.Sensors/SensorWorker.cs index 645eada..27cc803 100644 --- a/NucuCar.Sensors/SensorWorker.cs +++ b/NucuCar.Sensors/SensorWorker.cs @@ -34,6 +34,7 @@ namespace NucuCar.Sensors /* If sensor is ok attempt to read. */ if (sensorState == SensorStateEnum.Initialized) { + Logger.LogTrace($"{sensorIdentifier} is taking a measurement!"); await Sensor.TakeMeasurementAsync(); } /* Else attempt to re-initialize. */ @@ -49,6 +50,7 @@ namespace NucuCar.Sensors else if (sensorState == SensorStateEnum.Disabled) { // Break from while. + Logger.LogInformation($"{sensorIdentifier} has been disabled!"); break; } diff --git a/NucuCar.Sensors/Telemetry/TelemetryWorker.cs b/NucuCar.Sensors/Telemetry/TelemetryWorker.cs index 3b162df..ebe8a8e 100644 --- a/NucuCar.Sensors/Telemetry/TelemetryWorker.cs +++ b/NucuCar.Sensors/Telemetry/TelemetryWorker.cs @@ -30,6 +30,7 @@ namespace NucuCar.Sensors.Telemetry { if (!_serviceEnabled) { + _logger.LogInformation("Telemetry service is disabled!"); return; }