Centralise check for debug output