Another demo by @eastgate
xlogs-2.tbx (113.3 KB)
What it does:
Adds functions for writing diagnostic messages to a log note. This is extremely helpful for gaining insight into what your functions are doing.
Techniques:
- Defining functions
- Manipulating styled text
Look at note /Hints/Library/Logs Library
in the TBX.
To try it yourself:
See the bottom lines of the code; these exercise the functions and write specimen logging to note /Logs
in the same TBX.
The “Logs Library” is essentially a self contained ‘library’ of functions that can be copied to other TBX and used the same ways. Once you’ve seen the logs working, you might to well to comment out the example calls at the bottom of the note (by starting the line with //
. That way you can refer to them for a reminder of how to call the logging functions but not actually have them execute.
A meta-demo in this is the notion of being able to take a library note from one TBX and place it in another. Note that if you do similar with your own library notes and these interact with user attributes, it is suggested you add a comment to the function indicated the attributes needed (and their data type, default, etc.).