[weboob] Loggers

Romain Bignon romain at peerfuse.org
Sat Oct 30 18:55:26 CEST 2010


I've changed things related to logging in Weboob.

Now, there is a module named weboob.tools.log. We would need to use different
loggers for each part of Weboob. The only function useful in this module is:

getLogger(name, parent=None)

You can give a parent logger to complete the name of the logger, for example the
class Browser can take a parent logger, then its logger can be named like

Also, BaseBackend use a logger named by its instance name. So each instance of
backend uses a specific name.

Now, in parts which uses a specific logger, please use functions on it instead
of global logging functions. For example in a backend class, use:
>>> self.logger.warning('hello!')

There is also specific logger in BaseApplication and BaseBrowser.

Then, I've added a new parameter to BaseApplication: --logging-file. You can use
it to log into a file instead of stdout. It's useful for havesex for example,
which has several background jobs.

And the last one, the killer feature, the eye candy way: now, when log messages
are written on stdout, they are colored functions of level!

Debug messages are in blue, warning in gray and errors in red.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <https://lists.symlink.me/pipermail/weboob/attachments/20101030/01b52fe2/attachment.sig>

More information about the weboob mailing list