Keep the root topic out of the log: print endpoint ids and topics without their root

The root topic identifies the account, and Serial logs get posted in issues and forums.
"repeated directive on <topic> ignored" and the lines for dropped directives printed the full
MQTT topic; they now start with the endpoint id. The lines for subscriptions and publishes print
the topic relative to the root (AlexaBridgeLogic::topicForLog), and begin() prints the length of
the root topic instead of its text. No line at any level prints the root topic, the username or
the password.
basicLight: RAM 34,476 -> 34,508 B, flash 338,281 -> 338,533 B; host tests 45 -> 47.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
David 2026-09-28 18:45:18 +00:00
parent 2ed52c8721
commit d534f23f27
7 changed files with 79 additions and 25 deletions

View file

@ -130,6 +130,7 @@ private:
AlexaDevice *findDevice(const char *endpointId, size_t length);
AlexaSendResult trySend(const char *topic, JsonDocument &doc, size_t *length);
void logRefusal(const char *topic, AlexaSendResult result, size_t length);
const char *logName(const char *topic) const; // The topic as the log may print it: without the root topic
};
#endif // ALEX2ESP_H