Re: Macro used for debugging
Any comments ??
Or, Is it worth having this in Wiki ?
Re: Macro used for debugging
Sorry, I'm a bit sleepy right now... but what's the point of this macro?
Re: Macro used for debugging
Well,
The macro allow you to print a debug message which has the filename, line number and the function name. this macro can be enable/disabled using
Code:
#define APP_NO_DEBUG_MESSAGES
You can disble/enable the Filename, Function name and the line number
Both the function name and the filename can be short or more descriptive
Code:
# define DEBUG_PRINT_FILEPATH
# define DEBUG_PRINT_SHORT_FN_NAME
# define DEBUG_PRINT_LINENUMBER
The output is aligned and the width of the field can be configured
Code:
// file name
# define DEBUG_FILEPATH_LENGTH 27
# define DEBUG_FILENAME_LENGTH 22
#
// Function
#
# define DEBUG_LONG_FUNCTION_LENGTH 40
#
# define DEBUG_SHORT_FUNCTION_LENGTH 25
#
// LineNumber
#
# define DEBUG_LINENUMBER_LENGTH 4
so for line
Code:
void foo(){
DEBUG() << "I am here ";
}
void foobar(){
DEBUG() << "Yupppy ";
}
the output would be
Code:
src/filename.cpp [ 2] void foo() : "I am here "
src/filename.cpp [ 6] void foobar() : "Yuppy"
Since the output is aligned, it is easier to comprehend
Re: Macro used for debugging
C00l... although complicated :) Can't you make it work so that it is called by using qDebug() (so that one doesn't have to replace all qDebug() calls)?
Re: Macro used for debugging
Quote:
C00L.... although complicated
Thanks :)
Anyone can do that, replacing the DEBUG with qDebug in the #define DEBUG() should do I think . But I personally would not want to do that . Hmmm, Just doesn't look fine. what if I do not want the extra information for a some set of debug messages
Re: Macro used for debugging
the question still remains....
Is it helpful to have this in our wiki ?
Re: Macro used for debugging
Quote:
Originally Posted by
sunil.thaha
Anyone can do that, replacing the DEBUG with qDebug in the #define DEBUG() should do I think .
I don't think so, because you use qDebug() in your debug macro, so you can't substitute qDebug using a different macro. What I'd like to see is to substitute the qDebug macro to add information you add in your macro. Sorry if the explanation sounds complicated...
1 Attachment(s)
Re: Macro used for debugging
How about having this on top :cool:
Code:
#if defined( qDebug )
# undef qDebug
#endif
PFA driver file.
So is it fine to have it in our wiki ?
Re: Macro used for debugging
I think you don't understand... Your macro uses qDebug(), so you can't undef it or it won't work.
Re: Macro used for debugging
Did you try out the driver file. it works for me ...
Re: Macro used for debugging
Since there has been three downloads ... Did anyone find it useful ?