I started to add a new feature in a some month old project and needed to get some variable contents (the variables name are meaningful, but not enough…).
So I used System.DebugLog. Then, I wanted to Copy / Paste these information for later reminder.
Not possible with Xojo 2015r1. Before using drastic measures (save it into a text file for example), I checked what happens with the current version (Xojo 2021r2):
Fantastic: Copy / Paste works fine !
Thank you Xojo for this addition.
Note to self: it may be a good idea to generate a DebugLog file, so I will always have handly the running flow in case I need it (for debug or a repport of how things works while I implement a new feature.
A new Method whose syntax can be Debug_Log("My debug string")…
What is your feeling ?
I implemented the Save to file text debug stuff. It was nice and allow me to write code faster (less run / debug | write code / run), à la DB when you have a software that allow you to read what you wrote in the db file.
you could use Conditional compilation — Xojo documentation
for each feature or part that you want to debug log.
its also good to enable the log by menu or key phrase to shrink the output.
Better? “Better” always depends (on various things).
I just thought “why write a debug/error/crash/… log-file mechanism” while the underlying OS’s already offer standardized mechanisms for collecting/storing/sharing/… such information? On Windows it’s the Event Log and on macOS/Linux/Raspi it’s the System Log.
The only thing I have to add with using the system log is that App Sandboxed apps cannot retrieve the contents of the log, if you want to provide the ability for a customer to mail you the log.