πŸŽ“ Flow Logs

by Patrick Corgan

Version 2 (October 1, 2023)

Download (115 downloads)

Learn everything you need to know in order to monkey around with a flow's log. This was never meant to be a user-facing operation, so there are a few eccentricities to be aware of.

A flow's log in Automate is stored as a file with the path "/data/data/com.llamalab.automate/app_logs/flow-{flowID}.log". This means that you can treat a flow's log just like any other file: display it or parts of it to the user, read from it, write to it, and so on. If you want to clear the log, do not delete the file. If the file is deleted - even if it is recreated - the log will no longer display on the flow screen. Also, every log entry should end with a newline, including the final one, otherwise the entry won't display on the flow screen. Note that a flow can manipulate not just its own log, but that of any flow, running or not.

You also have limited control of the color of a log entry. There are four possibilities: red; yellow; grey; or the default black if you're using the light theme, or white with the dark theme. The color is controlled by 20th character of the entry: "F" for red (fault), "W" for yellow (warning), or "D" for grey (debug). Anything else is default color, and all the other characters can be anything at all. The unconnected block (#9) contains examples using Automate's method of logging that makes sensible use of the first 19 characters of an entry. Or you can use zero-length characters as padding. MyNameisBob (Pluto) used "\u200b" which seems to work wonderfully.

Note that this likely represents a security hole in the eyes of the Automate developer, as a malicious flow could erase its log, thereby covering up its nefariousness. So we might lose the ability to edit flow logs, which would be sad.

Thank you to Ricardo FernΓ‘ndez Serrata and his flow "Error text template" (https://llamalab.com/automate/community/flows/41617), and to EXP's comment on that flow, from both of which I borrowed liberally and shamelessly.

Also thank you to MyNameisBob (Pluto) and the flow "Custom Error message!" (https://llamalab.com/automate/community/flows/45217) for the log messages using zero-length characters. That makes all this actually useful.

------------------------------
π˜‰π˜Ί π˜—π˜’π˜΅π˜³π˜ͺ𝘀𝘬 𝘊𝘰𝘳𝘨𝘒𝘯
πŸ› οΈπ•”π• π•žπ•žπ•–π•Ÿπ•₯𝕀 π•’π•Ÿπ•• π•”π•£π•šπ•₯π•šπ•”π•šπ•€π•žπ•€ π•¨π•–π•π•”π• π•žπ•–βš’οΈ
------------------------------

Version 2: Added zero-length-character padding to more sensibly colorize log messages.

5.0 average rating from 5 reviews

5 stars
5
4 stars
0
3 stars
0
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.