Rationalise API debug logging