Empty queueLabel strings in [DispatchQueueLogFormatter queueThreadLabelForLogMessage:]

29 views
Skip to first unread message

Matt G

unread,
Nov 27, 2013, 6:58:48 AM11/27/13
to cocoalu...@googlegroups.com
Hi,

queueThreadLabelForLogMessage does this to see if there it should use the queueLabel:

if (logMessage->queueLabel)



Unfortunately queueLabel is guaranteed never to be NULL due to this code in [DDLogMessage initWithLogMessage:…]

        if (!gotLabel) {

            queueLabel = dd_str_copy("");



(also dispatch_queue_get_label is quit entitled to return an empty string too)

As such, queueThreadLabelForLogMessage never falls back to using the threadName or threadId and will return a useless empty string when label is empty.


Seems the easy fix is to change the above test to 

if (logMessage->queueLabel && logMessage->queueLabel[0])


I'd commit it myself, but alas I'm unable due to workplace policy

Regards


Matt

Bogdan Poplauschi

unread,
Nov 27, 2013, 12:35:18 PM11/27/13
to cocoalu...@googlegroups.com
Hi Matt,

This is a very good catch. Could you create a pull request?

Thanks,
Bogdan
Reply all
Reply to author
Forward
0 new messages