[pygtk] g_log_set_handler?
Christian Robottom Reis
kiko at async.com.br
Sun Jun 20 01:52:08 WST 2004
On Fri, Jun 18, 2004 at 09:44:50AM +1200, Tim Evans wrote:
>
> I think that maybe the Python 'logging' module would be a better choice
> than Python warnings.
>
> http://docs.python.org/lib/module-logging.html
The idea I had was that the logging module was for application-level
messages, not toolkit-level ones. Granted, some packages like the ZODB
use it throughout, but in general I would consider using logging to
convey PyGTK messages a bit awkward, since they aren't really
application-level messages. Is this not the case?
> The different levels of g_log would be translated into the equivalent
> Python logging levels as follows:
>
> G_LOG_LEVEL_ERROR logging.CRITICAL
> G_LOG_LEVEL_CRITICAL logging.ERROR
> G_LOG_LEVEL_WARNING logging.WARNING
> G_LOG_LEVEL_MESSAGE 25 (between WARNING and INFO)
> G_LOG_LEVEL_INFO logging.INFO
> G_LOG_LEVEL_DEBUG logging.DEBUG
I feel that the match between GTK+ warnings and Python warnings is quite
a good one, since they both mean something similar in a very low-level
sense (that you're doing something code-wise that isn't quite right, but
that is probably easily fixed).
I don't know, however, how reasonably the other levels would match up to
Python exception semantics.
Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
More information about the pygtk
mailing list