This commit is contained in:
Christopher Cookman 2026-05-09 10:38:21 -06:00
parent 0752221b85
commit 1a49ebbc08

View file

@ -570,25 +570,27 @@ xmpp.on("stanza", (stanza) => {
} }
}) })
}); });
fs.writeFileSync(logPath, JSON.stringify({ if (process.env.LOG_EVENTS === "true") {
evt, stanza, product_id, product_id_raw, bodyData, body, sentData: { fs.writeFileSync(logPath, JSON.stringify({
"type": "iem-message", evt, stanza, product_id, product_id_raw, bodyData, body, sentData: {
"data": { "type": "iem-message",
"channel": getWFOByRoom(fromChannel), "data": {
"fromChannel": fromChannel, "channel": getWFOByRoom(fromChannel),
"event": evt, "fromChannel": fromChannel,
"body": bodyData, "event": evt,
"timestamp": product_id.timestamp, "body": bodyData,
"wmo": product_id.wmo, "timestamp": product_id.timestamp,
"pil": product_id.pil, "wmo": product_id.wmo,
"station": product_id.station, "pil": product_id.pil,
"product_data": product_id, "station": product_id.station,
"raw": product_id_raw, "product_data": product_id,
"rawBody": body, "raw": product_id_raw,
"image": stanza.getChild("x").attrs.twitter_media || null "rawBody": body,
"image": stanza.getChild("x").attrs.twitter_media || null
}
} }
} }, getCircularReplacer(), 2), 'utf8');
}, getCircularReplacer(), 2), 'utf8'); }
} }
tryGetText(); tryGetText();
} }