Tinderbox v9 Icon

Using a log file to review interim code outputs

Tinderbox has no fixed logging system but this is easily set up in a way that suits the user simply by writing code values to the $Text of a log, i.e. another note. Thus

Make a note. 'log' is a simple default name. Ideally put is somewhere easy to find and avoid a complex name and/or pat that might make addressing the note difficult. Placing it at root of the outline is a good initial choice, i.e. $Name 'log', $Path '/log'.

In the code to be tested write to the log by altering $Text(/log):

$Text(/log) = "Current value of vPath is: "+vPath+"\n"; 

Be aware using '=' overwrites existing log text, so an increment '+=' makes more sense, as does an opening call at top of the code to 'reset' the log removing old content. so at start of the code being tested:

$Text(/log) =; 

Then later in the code:

$Text(/log) = "Current value of vPath is: "+vPath+"\n"; 

In this case, after the code is run, the log should record the value of variable 'vPath'. A mix of literal string and a value is useful for indicating the code ran. For instance, you may see the literal text but no value indicating the code at least executed up to the logging point but the value assumed to be in the variable vPath has in fact not been set.

In a long-lived document is it easy to go a stage further and make user functions to reset to log or to write to it. For writing , that takes care of remembering to forma the input, add a line break, etc.

If using logging in code it is a good idea to comment out the log call or remove it when done and to check the log file and delete accidentally accrued content.