Major refactoring and simplification of logging subsystem. More C++ style yet more efficient.