[Development] QLog ( Work on qDebug and friends)

BRM bm_witness at yahoo.com
Wed Feb 15 17:14:12 CET 2012


> From: Lincoln Ramsay <lincoln.ramsay at nokia.com>
> To: development at qt-project.org
> Cc: 
> Sent: Tuesday, February 14, 2012 8:05 PM
> Subject: Re: [Development] QLog ( Work on qDebug and friends)
> 
> On 02/15/2012 01:47 AM, ext BRM wrote:
>>  I'd much rather see a Category object being pushed via 
> operator<<()
>>  instead so that it can be detected and allow things like:
>> 
>>  // assume QMessageLoggerCategory(category) is a class
>>  qDebug() << QMessageLoggerCategory("category1")<<  
> "message for
>>  category1"<< 
> QMessageLoggerCategory("category2")<<  "message for
>>  category2";
> 
> This fails the "do nothing quickly" test so the cost of leaving such 
> statements in shipping code is high, even when the categories are disabled.
> 
> This works fine though.
> 
> qLog(category1) << "message for category1";
> qLog(category2) << "message for category2";

No more than the Macro.

Yes, it would need to read all the strings; but then it could just read them instead. The macro fails in the same respect.

It can also do the same test - and output an empty (or special) object if the category is not enabled, or a complete object if it is not..
And the first qDebug() can be still managed by the macro to completely disable everything just the same.

Ben




More information about the Development mailing list