Recommendations on how to use a log and error note to debug code?


I was noticing in MarkB’s wonderful parsing meeting notes Meetup and file located here

he uses a log and error file to debug code. Brilliant…I want to do that too but sadly, there is little to document this piece, which is why I asking the forum. MarkA, I did not see this topic in aTBRef, if I missed it…my bad. IMO It might be a good topic to include at some point in the future.

Any advice on how you are using a log and error note to debug your code. Any information here would be a good start for me.

I did not include a sample file just because MarkB has his in the link above.

Thanks in advance to any advice.


1 Like

See Logging tool (LogRec) suitable for tracing Action Code

1 Like

FWIW, the reason it’s not in aTbRef is because it’s not an app feature, but instead falls into the how to.

Essentially the heart of the matter is to write to the $Text of a note at a known location, e.g. a simplest by code in your action like so:

$Text(/log) += "Some message"+"\n";
// the log message might be a literal message as above, an attribute value, variable, etc.

How complex you want the log process to be is open to the individual. For instance you might choose to do more with each message and add the extra info by calling a logging function which then writes to the log note. The thread in the post above above has a solid start.