Update 28-May-2022: The Toolbox provided in this original post has been updated significantly. The newer version can be downloaded from the more recent post on this topic titled “Logging tool (LogRec) suitable for tracing Action Code.”
Original post:
I have developed a moderately simple tool that allows Tinderbox users to record log entries in log books. I’m sharing this tool with the Tinderbox community via this posting, and would very much appreciate feedback and any suggestions for improvements.
In a nutshell, this document provides a function that can be called as:
LogRec(logbook,entry);
The function will append a new record containing the text provided as the “entry” argument to a Tinderbox note specified by the “logbook” argument. If the referenced logbook does not exist, it will be created and initialized on the fly.
Logging is a powerful capability that can be used for a variety of purposes. It is often used to maintain a record of events as they happen over time, or for debugging purposes. I suspect that other Tinderbox users will find the debugging aspects of logging to be especially useful since code can have calls to the LogRec() function inserted that will record the current state of variables or other data used by their code, or indications of what path has been taken within their code.
While the concept of logging is simple, it turns out that there are a lot of practical considerations that can complicate real world logging. I have tried to provide some useful enhancements that improve the utility of logging operations, yet keep things fairly simple.
In the attached Tinderbox document named “Toolbox v1a” I have included a note labeled “Logging Tools” under the “Main Document” container. This provides a comprehensive description of the complete logging package included, along with instructions on how to use this tool and associated notes, containers, and stamps. Again, I welcome feedback and suggestions for this documentation.
My aspirational objectives for sharing this logging tool are to establish a foundation for developing and sharing other tools that could be broadly useful to the Tinderbox community. In this regard, I am soliciting the following:
- Your experiences with actually incorporating these logging tools into your documents, should you try this. I anticipate that there will be a few rough spots, and so this exercise represents an opportunity to collectively learn how best to facilitate sharing of tools and other reusable code while documenting the practices that work best.
- Ideas/suggestions for other tools that people would find useful. Some of the community members have considerable experience with Tinderbox coding, and perhaps have tools that can be packaged up and shared. At the same time, suggestions for tools that you might have wished you had would be helpful feedback.
- Thoughts, suggestions, practical experiences that relate to the ways that tools can be moved between documents. In many cases, this will involve more than just copying code, but will require setting up attributes, containers, prototypes, templates, stamps, etc. that will be part of the tool package.
- Insights into what would be required to set up a repository that enables sharing of tools with each other. What guidance can offered for how to add to a repository, and also to utilize a repository in building out our Tinderbox projects.
This is an ambitious agenda, but I hope to get us started by putting forward a tool that some of you may find useful. I am willing to serve as a coordinator for efforts to build and distribute a toolbox repository.
…Chuck Wade
Toolbox v1a.tbx (214.0 KB)