Re-work debuglog
Re-work debuglog

Makes it more testable, and one less global var

sammyshj/txtorcon,meejah/txtorcon,ghtdak/txtorcon,meejah/txtorcon,david415/txtorcon,isislovecruft/txtorcon,david415/txtorcon,isislovecruft/txtorcon,ghtdak/txtorcon,sammyshj/txtorcon