How to log events in HomeyScript and how to retrieve them

in a HomeyScript I use

console.log(msg) ;

to log the steps in the script. This works for testing, but how can I log the same messages during live runs and how to see them?

You should use an external (cloud) service, maybe a simple Vercel function + Turso DB (free) and POST it with fetch. There is no built in method at least

You can save the msg to a Homeyscript tag; these tags are available to use in, like, notification cards, Simple Log app cards and such.
As shown in the examole scripts:

Another way is to write directly to such a flow card.
Code snippet:


if(windowOpen == true)
windowText = "\nThese windows are open:\n" + windowText + "\n";
else
// comment this out if you don't want a msg when all's fine:
windowText = "All windows are closed.";

Homey.flow.runFlowCardAction({
        uri: 'homey:manager:notifications',
        id: 'create_notification',
        args: {
          text: String(windowText) + '\n[Source: Hscript window_open.js]'
        },
      });


Thanks, I will go for this solution.