You can use conditional compilation to differentiate between live and dev as below (PRP is our live). So $$$debug(x) either shows the value in x on the screen in test or does nothing in live. Slight disadvantage is that what you test is not EXACTLY identical to what you run in live - but that's going to be the case anyway if you are "adding differences afterwards". 

 #if $NAMESPACE'="PRP"
 ; ############### test environment includes debug code
 #Define debug(%var) Write @(%var)
 #Define CSPdebug(%prog,%var) S MACROT2=$P($ZTIMESTAMP,",",2),^CSPLOG(%prog,+$H,MACROT2,"%var")=$D(%var)_"`"_$G(%var)
 #Define CSPdebugfull(%prog,%var) S MACROT2=$P($ZTIMESTAMP,",",2),^CSPLOG(%prog,+$H,MACROT2,"%var")=$D(%var)_"`"_$G(%var) I $D(%var)>1 S MACROT1="%var" F  S MACROT1=$Q(@MACROT1) Q:MACROT1=""  S ^CSPLOG(%prog,+$H,MACROT2,MACROT1)="`"_@MACROT1
 #Define CSPdump(%prog) S MACROT2=$P($ZTIMESTAMP,",",2),MACROT3="" F  S MACROT3=$O(@MACROT3) Q:MACROT3=""  S ^CSPLOG(%prog,+$H,MACROT2,MACROT3)=$D(@MACROT3)_"`"_$G(@MACROT3) I $D(@MACROT3)>1 S MACROT1=MACROT3 F  S MACROT1=$Q(@MACROT1) Q:MACROT1=""  S ^CSPLOG(%prog,+$H,MACROT2,MACROT1)="`"_@MACROT1
 ; ############### end test environment includes debug code
 #else
 ; ############### live environment no debug code
 #Define debug(%var)
 #Define CSPdebug(%prog,%var)
 #Define CSPdebugfull(%prog,%var)
 #Define CSPdump(%prog) 
 #endif

$Query may help, but more likely to be 

S FF = ""
For {
    S FF=$O(^Users(FF))
    Q:FF=""

    I '$D(^Users(FF,"SETTINGS","isAllowed"))#2    {

        W "No settings for user "_FF
    } elseif ^Users(FF,"SETTINGS","isAllowed") {

        W "User ",FF," is allowed",!
    } ELSE {
         W "User ",FF," is not allowed",!
}

(That assumes the 1/0 value determines whether the user is / is not allowed rather than the existence of the node)