[Development] [Request] Add Info to QDebug

Alejandro Exojo suy at badopi.org
Sun Dec 22 19:01:51 CET 2013


El Saturday 21 December 2013, Kurt Pattyn escribió:
> Qt currently supports the following ‘severity’ levels for logging: Debug,
> Warning, Critical, Fatal and System.
> 
> I propose to add the following levels: Info and Error, with associated
> methods qInfo() and qError(). Particularly, the Info severity can be
> interesting to have applications output log messages that are not
> warnings, but also not debug messages. Error would fit between Warning and
> Critical.

While not a terrible thing to have, I fail to see what's exactly the use case. 
I think it would even cause some confusion.

The "info" level doesn't make much sense for a class that outputs to stderr. 
If you want to inform the user with text, you probably want the standard 
output, isn't it?

About "error", I don't see when you would use it instead of the other or which 
advantadge it gives. I see it this way:

- Debug: almost everything goes there. Since it can grow messy quickly, you 
have the categories to filter things easily. Is disabled by QT_NO_DEBUG_OUTPUT 
since users might be spared of those messages.

- Warning: is a notice that something went wrong, but it might not affect the 
application. You can disable it with QT_NO_WARNING_OUTPUT since is not that 
important.

- Critical: something serious really happened, so the message can't be 
disabled. You really want to print something because something critical is 
happening.

- Fatal: same as above, but the application even aborts afterwards.


The Error level would only make sense if for whatever reason you want to 
follow Unix syslog, but we are not going to get it right at this point IMHO, 
since syslog has a lot of levels that are just numerical behind the scenes. 
From syslog(2) manpage:

       #define KERN_EMERG    "<0>"  /* system is unusable               */
       #define KERN_ALERT    "<1>"  /* action must be taken immediately */
       #define KERN_CRIT     "<2>"  /* critical conditions              */
       #define KERN_ERR      "<3>"  /* error conditions                 */
       #define KERN_WARNING  "<4>"  /* warning conditions               */
       #define KERN_NOTICE   "<5>"  /* normal but significant condition */
       #define KERN_INFO     "<6>"  /* informational                    */
       #define KERN_DEBUG    "<7>"  /* debug-level messages             */

That would make necessary to create Alert and Emergency too. That's quite 
overkill IMHO.

-- 
Alex (a.k.a. suy) | GPG ID 0x0B8B0BC2
http://barnacity.net/ | http://disperso.net



More information about the Development mailing list