kDebug and the Application object

Thiago Macieira thiago at kde.org
Sun Apr 13 17:03:41 BST 2008


Michael Jansen wrote:
>i get
>
><unknown program name>(11138)/ main: Application starts
>testcase(11138) main: Application starts
>
>So kDebug learns the application name sometime during the creation of
> the application object. 

Technically, it's during the creation of the main KComponentData.

> That behavior is not documented for kDebug() 
> and friends. I think it should be if that is indeed the correct
> behavior.

Why? We don't document we print the PID, application name or function name 
at all. In fact, we don't have to. It can be anything. It depends on the 
backend.

>I stumbled upon that with an KUniqueApplication doing some checks before
>starting the application and giving some info's to the user.

Well, as long as it isn't using kDebug for that. kDebug is for debugging 
info, not to give some information to the user.

>What am is supposed to do. I ported the printf calls used to kDebug
> thinking that would be correct. Should i go back to printf and friends
> or is there a way to set the application name earlier?

See what I wrote above. If it's information to the user, it should be 
printf. If it's debugging (meaning it gets disabled in a release build), 
kDebug should be fine.

In that case, if it prints <unknonw program name> is irrelevant.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080413/61efb1b7/attachment.sig>


More information about the kde-core-devel mailing list