Add a 'debug' mode, controls whether or not logging is enabled

.