diff --git a/Source/ProofOfConcept/Services/MQTTServer.cs b/Source/ProofOfConcept/Services/MQTTServer.cs index cb1f2d9..4736c69 100644 --- a/Source/ProofOfConcept/Services/MQTTServer.cs +++ b/Source/ProofOfConcept/Services/MQTTServer.cs @@ -1,4 +1,5 @@ using System.Net; +using System.Text; using Microsoft.Extensions.Options; using MQTTnet.Protocol; using MQTTnet.Server; @@ -54,7 +55,7 @@ public class MQTTServer : IHostedService return Task.CompletedTask; } - logger.LogInformation("Client {ClientID} published message to topic: {Topic}", e.ClientId, e.ApplicationMessage.Topic); + logger.LogInformation("Client {ClientID} published message to topic: {Topic}: {Message}", e.ClientId, e.ApplicationMessage.Topic, Encoding.UTF8.GetString(e.ApplicationMessage.Payload)); return Task.CompletedTask; }; @@ -93,7 +94,7 @@ public class MQTTServer : IHostedService { if (e.UserName != configuration.Observer.Username || e.Password != configuration.Observer.Password) { - logger.LogWarning("Observer tried to connect with invalid credentials"); + logger.LogWarning("Observer tried to connect with invalid credentials: {Username} / {Password} from {RemoteIP}", e.UserName, e.Password, e.RemoteEndPoint is IPEndPoint ipEndPoint ? ipEndPoint.ToString() : e.RemoteEndPoint.GetType().FullName); e.ReasonCode = MqttConnectReasonCode.NotAuthorized; } }