Implement debug on/off functionality