conditional console.log when DEBUG == true, API change to add deviceIndex parameter.