[Interest] Logging best practice.

Tim Dewhirst tim at bugless.co.uk
Mon Dec 19 21:51:40 CET 2011


Evening,

On 19/12/2011 16:15, Bo Thorsen wrote:
> Den 19-12-2011 13:32, David Faure skrev:
>> On Friday 09 December 2011 13:56:54 Bo Thorsen wrote:
>>> Den 09-12-2011 10:31, kai.koehne at nokia.com skrev:
>>>> Syntax could e.g. be:
>>>>
>>>> qLog(QWidget).location(__FILE__, __LINE__)<<    "Created"<<    name;
>>>>
>>>> (Maybe __FILE__ , __LINE__ can be automatically retrieved by yet another
>>>> macro? Not sure ...).
>>> You can only do that if qLog is a macro itself.
>>>
>>> Alternatively, it could be done with one of my long standing christmas
>>> wishes: qBacktrace() :)
>>
>> Hi Bo!
>>
>> Here's your christmas gift, a little bit in advance :-)
>>
>> http://www.davidfaure.fr/kde/qbacktrace4
>
> Hi David :)
>
> I know about this one, and I have one using libunwind in my own code
> set. I also had one on Windows, but that was customer code.
>
> My christmas wish is for a qBacktrace that's in Qt and supported on
> (almost?) all platforms.
>
> Unfortunately it looks like it's impossible to do this on Symbian, so
> while that's a supported platform it's not possible to have this for all
> platforms.
>
> David, if I do the backtrace code on Windows and push the patch to
> 4.9/5.0, will you do the same for this code? Then we just need someone
> to add the code for Mac, and we're well on the way.

On OS X, backtrace will work and from Lion onwards there's another 
possibility:

http://stackoverflow.com/questions/220159/how-do-you-print-out-a-stack-trace-to-the-console-log-in-cocoa

Tim



More information about the Interest mailing list