Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a named logger and supplement all logged messages with the logger's name #1933

Open
vabor112 opened this issue Jan 19, 2024 · 3 comments

Comments

@vabor112
Copy link

Where should the content be modified?

Throughout the library, whenever logging is used

What should be modified?

Instead of just doing logging.info("something") or similar, I propose using

logger = logging.getLogger("geomstats")
logger.info("something")

Furthermore, I suggest not to set logging.basicConfig in geomstats/_logging.py, which changes the config of the root logger, but operatre on logging.getLogger("geomstats"). Finally, I think that log messages of format "INFO:geomstats: ..." are much more appropriate than just "INFO:" which may be confused with logs of another library. At the very least, I would suggest changing "INFO: Using numpy backend" and similar into "INFO: geomstats is using numpy backend".

Additional information

Here is the reason I am suggesting this. We use geomstats in our GeometricKernels library, always with the numpy backend. Our library itself supports different backends (jax, torch, tensorflow, numpy), but regardless of the backend a user choses to use, they always get "INFO: Using numpy backend" from geomstats. It is extremely confusing in this case as it is unclear which library logged this message and it is hard to filter, because everything goes through the root logger.

We at GeometricKernels would really appreciate it if you could implement the suggestion above.

P.S. We cannot use geomstats with the matching backend because 1-1 mapping is impossible: geomstats does not support jax. What is more, we do not currently use any computationally demanding functions from geomstats, so there is no much need in going beyond numpy.

@luisfpereira
Copy link
Collaborator

Thanks @vabor112. This is definitely a very good suggestion. Would you be willing to do this change? If not, I'll take it whenever I find some time.

@vabor112
Copy link
Author

Thanks @vabor112. This is definitely a very good suggestion. Would you be willing to do this change? If not, I'll take it whenever I find some time.

Cannot promise anything, but maybe I'll find time in the next week or two. I think the changes are quite minimal and simple, but I have never contributed to geomstats before, so there's risk that setting things up will take some time.

@jsilter
Copy link
Contributor

jsilter commented Mar 27, 2024

I just wanna bump this, as I just recently started using geomstats in a multiprocessing context and am overwhelmed with this exact same message repeatedly.

jsilter added a commit to jsilter/geomstats that referenced this issue Mar 27, 2024
Related to geomstats#1933

Change logging level of this message, and clarify that it applies to geomstats.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants