Log all debug messages and compute debug related stuff only if #debug