Logging setup in browser.py clobbers other logging
The logging in browser.py calls the root logger, which can cause unexpected changes to the setup and output in some testing environments. It would be preferable to have it log to something like:
LOG = logging.getLogger(__name__)
...
except ImportError as e:
LOG.debug(f"Import warning: {e}")
Trying to guess the intent behind #994 here. What's the usecase?
The problem with that approach in #994 is that logging.debug(f'Import Warning: {e}') does a logging.basicConfig() if there's no root handler defined. That seems to setup a StreamHandler on the root to stderr. We setup our logging expecting that it starts clean.
Most of us will do import splinter somewhere at a module top.
The problem is that at import time (before import splinter) it's rather hard to setup some meaningful logging.
With #994 that still means there's no output on a missing import.
With Jordan's above patch it will be still hard to have anything printed because you'll need to setup logging at import time (before import splinter).
I think @jsfehler imported splinter somewhere in code, after logging was setup. In this case there's a chance to get something on stderr(?) or on a configured logger with #994 .
@jordanvance Good catch. Yes, not getting a logger just for splinter is a mistake.
@agroszer The reason this logging is set to the debug level is that it's only useful for debugging the splinter library. 99% of the time it's not useful information. The correct behaviour is to ignore missing but optional imports, so the log message would just be noise. When testing if splinter is working at all, however, this message can solve an extremely simple gotcha: You forgot a dependency. If all else fails, you can setup your logger before importing splinter and get something meaningful.
Closed via #1054.
can we get a release please?
Sorry completely missed this. @jsfehler should we push out a patch-release? Or should we wait for the next regular release?
@fsouza @jsfehler i'd love to get a patch release if possible as 0.18.0 has handling for the deprecations released in selenium 4.3.0.
@fsouza I see no reason to wait.
Sounds good I'll publish 0.18.1
Sent #1061. I haven't bumped the version in a while, so opened as a PR.
@fsouza @jsfehler thanks so much for everything!