Introduction
This posting updates my earlier Logging for Fun and Profit posting with a revised and enhanced “LogRec” function along with associated stamps and prototypes. I have made extensive use of the LogRec function in tracing Action Code that I’ve been working on, and it has proven to be an effective debugging tool. The current version improves on the original, and sets the stage for further enhancements and additional features.
The latest zip archive is provided here:
Toolbox v1h.zip (1.9 MB) Version 1h 25-June-2022
…includes the logging tool along with some other tools and a demo application that can be used to explore use of the LogRec function in tracing code execution. Of course, logging is a technique that can be applied to a variety of problems beyond debugging code.
Provided below is an overview of the contents included in this version of the “Toolbox” document:
Toolbox Overview
It is intended that this document become a repository for tools that can be used to develop, debug, and support applications built using Tinderbox. In pursuit of this objective, it will be important to explore and evaluate methods for integrating tools from various contributors, and facilitating incorporation of these tools into any Tinderbox user’s documents.
As a near term objective, it is hoped that a constructive dialogue will arise from the community as to what sorts of tools are needed, and how best to share these tools.
To get this initiative underway, an initial tool for recording log book entries is offered in this Tinderbox document. The next note, titled simply “Logging tools,” provides a comprehensive overview of the included LogRec() function, and related elements. Feel free to incorporate this logging tool into your Tinderbox documents, and to adapt it as you see fit. I ask only for feedback and suggestions for useful improvements, as well as ideas for other useful tools.
A separate note is provided in the “Main Document” Container titled, “How to add logging tools to another Document” that explains the extra steps necessary after copying the contents of this file into another Tinderbox Document. However, this technical note is somewhat out of date, and I hope to replace these procedures with a more automated method for adding a “package” to an existing or new document.
There are also two other tech notes provided that offer some examples of working with date and time handling in Tinderbox and suggestions for what to do “When code doesn’t work as expected.” The latter is still very rough, but it would be great to get suggestions for what to include. I intend to update both of these tech notes, and may offer them as new postings to the Forum.
The current version of this Toolbox also includes some additional tools:
- User Attributes document capture: The “Attributes:Capture User Attributes” Stamp will create a report in the currently selected Note of all User-defined Attributes. There is also a sample report in “Document Commons/Document Attributes” that incorporates recommended tab settings to improve readability of the generated report.
- “Safe Path” tools: There are two functions provided that deal with potential problems with path confusion when forward or backward slashes are included in Note $Names. In addition, there are three Stamps that apply these functions. These tools use a new User Attribute, “SafePath,” to capture the safe (i.e., escaped) path string for a Note. It is possible to update “SafePath” globally for every Note/Container in the current Tinderbox document.
- Demo Application: A simplistic application for handling re-stocking of a retail store is included to provide illustrations for using the LogRec function to trace execution of Action Code. This application is implemented as a series of “Play” Stamps plus a “Product” prototype and a sample set of products that might be found in a grocery store. The sample products are located under the top-level “Examples” Container.
- Document Commons: This Toolbox version also introduces a new approach for having a common repository within a Tinderbox Document where global variables and data structures can be maintained. This is an initial step toward what is planned to be a more comprehensive package management capability. By having the “Document Commons” Container be the last top-level Note in the current document, it can be easily referenced without even knowing the name of this Container. There are two functions provided for building an index Dictionary and retrieving the ID of the last top-level Note in outline order.
Feedback and suggestions for improving these tools would be much appreciated.
Chuck Wade
+1 508 277 6439