jaraco / jaraco/cssutils

CSSUTILS logger overrides existing config on import

Open
#13 1 comment 2 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
Python
Stars
92
Forks
30
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Read cssutils/errorhandler.py lines 51-56 and trace how the CSSUTILS logger is configured on first import. Define done as preserving an existing logger configuration, including the user's log level, instead of applying defaults; the issue does not name a test file, so identify the relevant existing coverage before making changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.