aqhome-nodes: log outbound messages. too.

This commit is contained in:
Martin Preuss
2025-09-22 20:24:58 +02:00
parent 732eb4f53d
commit 90f0590d18
4 changed files with 27 additions and 0 deletions

View File

@@ -1046,6 +1046,30 @@ void _setDeviceName(AQH_VALUE *value, uint32_t uid)
void AQH_NodeServer_WriteTtyMsgToLogFile(AQH_OBJECT *o, const AQH_MESSAGE *msg, const char *txt)
{
if (o && msg) {
AQH_NODE_SERVER *xo;
xo=GWEN_INHERIT_GETDATA(AQH_OBJECT, AQH_NODE_SERVER, o);
if (xo && xo->logFile) {
GWEN_BUFFER *dbuf;
GWEN_TIME *ti;
dbuf=GWEN_Buffer_new(0, 256, 0, 1);
ti=GWEN_CurrentTime();
GWEN_Time_toString(ti, "YYYY-MM-DD hh:mm:ss ", dbuf);
GWEN_Time_free(ti);
ti=NULL;
AQH_NodeMessage_DumpSpecificToBuffer(msg, dbuf, txt?txt:"");
_writeToLogFile(xo->logFile, GWEN_Buffer_GetStart(dbuf));
GWEN_Buffer_free(dbuf);
}
}
}
void _writeTtyMsgToLogFile(AQH_NODE_SERVER *xo, const AQH_MESSAGE *msg)
{
if (xo->logFile) {