Adds log method

This is cleaning up the tree passed in (and wouldn't work for string trees).  Cleanup is intended to perform cleanup of what the individual tree has setup (for example any custom caching).  In our case, there is no cleanup needed, so this should just be an empty function.