Adds a small logging/debugging framekwork.

This patch begins the process of adding better "debugging" State and
Traversal objects, so that I can inspect the application easier and find
bugs.