On 02/26/2013 02:31 AM, Eduardo Habkost wrote:
On Tue, Feb 26, 2013 at 02:00:07AM -0300, Lucas Meneghel Rodrigues wrote:
I must say I spent some time trying to understand why you created a
separate logger here, without any further setup. Care to explain?

Oops, I'm so used to write this on all code I write, that I didn't even
notice I had done it here without an explanation.  :-)

This just makes logging messages from this module appear under a
specific logger name instead of the root logger. There's no further
setup because no further setup is needed. Logging configuration is done
by the test runner, and if no logger-specific configuration is made, the
messages are propagated to the root logger. See:
http://docs.python.org/2/howto/logging.html#advanced-logging-tutorial

This is not very useful if only this module does that. But if every
module did that, it would be very easy to enable/disable/redirect/reconfigure
logging of specific modules without editing the modules themselves.
Also, even if no module-specific logging configuration is used, using
different loggers allow us to easily identify which module is generating
a log message (if we include the logger name in the log output).

All right, test pushed to next, thanks!

_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to