Add more fine grain debug options and remove overhead in debug log macros when logging is turned off.