cssutils icon indicating copy to clipboard operation
cssutils copied to clipboard

CSSUTILS logger overrides existing config on import

Open strokirk opened this issue 4 years ago • 1 comments

Hi!

On first import of cssutils, the 'CSSUTILS' logger is set up and configured with some default values, as can be seen here: https://github.com/jaraco/cssutils/blob/main/cssutils/errorhandler.py#L51-L56

This can lead to issues if your import of cssutils happens later than your main logging config setup, since it will override whatever is already configured. To avoid it, you must pre-emptively import cssutils before your own logging config.

It would be easier if cssutils detected if the logger has already been set up, and didn't add it's own default config in that case. At the very least, if it preserved the loglevel the user has selected that would help.

strokirk avatar Jul 14 '21 12:07 strokirk

Sounds reasonable to me. Can you draft a fix?

jaraco avatar Jun 03 '22 02:06 jaraco