#Print command for debug

magic

Active Member
3rd Party Module Dev
3rd Party Tool Dev
Joined
Mar 5, 2018
I would like to have compile
time print command.

#Print bla

On release mode the code will
not be include in target code.

But I still need the old
Print command to do its
job on both release/debug mode
 

Phil7

Active Member
3rd Party Tool Dev
Joined
Jun 26, 2017
First there is #Print, but this is for printing preprocessor constants as far as I know.
Second DebugLog "bla" is what you want to have, if I understood it right. It only prints if you are compiling in debug mode

And third I don't use DebugLog, because for me its to much to write and I am used to PureBasics Debug "bla", so I just used:
Cerberus X:
Function Debug:Void(message:String)
    #if CONFIG="debug"
        Print(message)
    #endif
End
That is certainly not ideal and I would suggest to change the function call from DebugLog to Debug or at least provide an alias called Debug

Cerberus X:
Alias Debug = DebugLog
 

dawlane

Active Member
CX Code Contributor
Joined
Jun 21, 2017
The #Print preprocessor is the closest the you will get to a message macro.
It can be used to output text, preprocessor values only during the parsing stage.
E.G.

#MY_PREPROCESS+="My preprocess"
#Print "#MY_PREPROCESS+=~q"+MY_PREPROCESS+"~q"
#Print "Build CONFIG is set to "+CONFIG
 

magic

Active Member
3rd Party Module Dev
3rd Party Tool Dev
Joined
Mar 5, 2018
Second DebugLog "bla" is what you want to have, if I understood it right. It only prints if you are compiling in debug mode
Oh this is what I want. Its already there :D
 
Top Bottom