Tests clean up after themselves better.
Terrible overlarge commit.

*) Replace get_log_level() and log_level() with effective_log_level()
   and get_log_levels().
*) Made a bunch of functions call as method only.
*) Fixed up a bunch of tests.
*) Removed some unused code.
Added to prevent errors on message output causing infinite recursion.
Added routine to fetch boolean logging status for optimization of critical paths
Whitespace fixes.