readthedocs / sphinx-hoverxref

Sphinx extension to show tooltips with content embedded when hover a reference.
https://sphinx-hoverxref.readthedocs.io/
MIT License
95 stars 40 forks source link

Logging: log only once each unknown `typ` #211

Open humitos opened 2 years ago

humitos commented 2 years ago

We are logging a lot of lines similar like the following multiple times. One per time that we find a reference without a typ defined.

Using default style (tooltip) for unknown typ (ref). Define it in hoverxref_role_types.

It would be log only once each different typ to avoid populating too much the output.

abravalheri commented 2 years ago

Hi @humitos is there a way of disabling this logging entirely?

I just noticed when building setuptools docs. I am OK with using the defaults and the logs end up in a very convoluted output for sphinx...

humitos commented 2 years ago

Unfortunately, there is no way to disable logging currently, as far as I know.

I found this message bothering myself as well, but I'm not sure what's the best way to communicate this to users. That's why I kept it and opened this issue to, at least, reduce the amount of lines logged.

Would it be enough for you to reduce the log as this issue propose, or you would prefer to remove the log completely and update the documentation saying if the typ is not defined the default will be used?

abravalheri commented 2 years ago

Unfortunately, there is no way to disable logging currently, as far as I know.

Yeah, I tried to add the following statement to docs/conf.py without success:

logging.getLogger("hoverxref").setLevel(logging.WARNING)

I don't know how sphinx work internally, but could it be the case it is using different processes? (Or maybe I am making a wrong assumption about how the logging module works).

Would it be enough for you to reduce the log as this issue propose

That would definitely be a big help.

But since it does not seem to be easy to select a logging level in sphinx, does it make sense to add logging entries that do not correspond to a real warning/error that the user should be concerned?