T
Thomas Heller
I'm using the logging module in my comtypes library to log
'interesting' things that happen. In other words, the idea
is if the user of the library is interested in the details that
happen in the package internally, he (she?) would configure
a logging level and handlers that write the log messages where it
is convenient.
This works great, with one exception:
If the script using the library does NOT configure logging, and somewhere the library calls
logger.error(...) or logger.critical(...) then he gets a message on stderr saying:
No handlers could be found for logger "foo"
Of course this can be avoided by configuring a NULL-Handler, or raising the
loglevel to a very high value - but why is this necessary?
I would assume that if no handlers are configured than simply the logging
package should not output anything...
Why does logging insist on a default level of ERROR even if unconfigured, and
why does it insist to output something even if no handler is defined?
I assume it would not be a good idea to configure logging in the library itself,
possibly overwriting explicit configuration that the user has done... I don't get it.
Thomas
'interesting' things that happen. In other words, the idea
is if the user of the library is interested in the details that
happen in the package internally, he (she?) would configure
a logging level and handlers that write the log messages where it
is convenient.
This works great, with one exception:
If the script using the library does NOT configure logging, and somewhere the library calls
logger.error(...) or logger.critical(...) then he gets a message on stderr saying:
No handlers could be found for logger "foo"
Of course this can be avoided by configuring a NULL-Handler, or raising the
loglevel to a very high value - but why is this necessary?
I would assume that if no handlers are configured than simply the logging
package should not output anything...
Why does logging insist on a default level of ERROR even if unconfigured, and
why does it insist to output something even if no handler is defined?
I assume it would not be a good idea to configure logging in the library itself,
possibly overwriting explicit configuration that the user has done... I don't get it.
Thomas