Only write to log if DEBUG is enabled