Skip to content

Commit 0c4ebda

Browse files
committed
fix: change how subscription state is logged to reduce traffic to console
1 parent 2c49fb9 commit 0c4ebda

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/PepperDash.Essentials.MobileControl.Messengers/Messengers/MessengerBase.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ protected void SubscribeClient(string clientId)
194194
{
195195
if (!enableMessengerSubscriptions)
196196
{
197-
this.LogWarning("Messenger subscriptions not enabled");
198197
return;
199198
}
200199

@@ -218,7 +217,6 @@ public void UnsubscribeClient(string clientId)
218217
{
219218
if (!enableMessengerSubscriptions)
220219
{
221-
this.LogWarning("Messenger subscriptions not enabled");
222220
return;
223221
}
224222

@@ -238,7 +236,7 @@ public void UnsubscribeClient(string clientId)
238236
return;
239237
}
240238

241-
this.LogInformation("Client with ID {clientId} unsubscribed", clientId);
239+
this.LogDebug("Client with ID {clientId} unsubscribed", clientId);
242240
}
243241

244242
/// <summary>
@@ -272,7 +270,8 @@ protected void PostStatusMessage(DeviceStateMessageBase message, string clientId
272270
}
273271
catch (Exception ex)
274272
{
275-
this.LogError(ex, "Exception posting status message for {messagePath} to {clientId}", MessagePath, clientId ?? "all clients");
273+
this.LogError("Exception posting status message for {messagePath} to {clientId}: {message}", MessagePath, clientId ?? "all clients", ex.Message);
274+
this.LogDebug(ex, "Stack trace: ");
276275
}
277276
}
278277

@@ -301,7 +300,8 @@ protected void PostStatusMessage(string type, DeviceStateMessageBase deviceState
301300
}
302301
catch (Exception ex)
303302
{
304-
this.LogError(ex, "Exception posting status message for {type} to {clientId}", type, clientId ?? "all clients");
303+
this.LogError("Exception posting status message for {type} to {clientId}: {message}", type, clientId ?? "all clients", ex.Message);
304+
this.LogDebug(ex, "Stack trace: ");
305305
}
306306
}
307307

src/PepperDash.Essentials.MobileControl/MobileControlSystemController.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,11 @@ private void RegisterMessengerWithServer(IMobileControlMessenger messenger)
13121312
/// <inheritdoc />
13131313
public override void Initialize()
13141314
{
1315+
if (!Config.EnableMessengerSubscriptions)
1316+
{
1317+
this.LogWarning("Messenger subscriptions disabled. add \"enableMessengerSubscriptions\": true to config for {key} to enable.", Key);
1318+
}
1319+
13151320
foreach (var messenger in _messengers)
13161321
{
13171322
try

0 commit comments

Comments
 (0)