Add logging to file, and cleaned up text.h/cpp.