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 loguru #303

Merged
merged 13 commits into from
Jun 6, 2023
Merged

Use loguru #303

merged 13 commits into from
Jun 6, 2023

Conversation

xiki-tempula
Copy link
Collaborator

@xiki-tempula xiki-tempula commented Apr 2, 2023

Switch to use loguru for logging
Fix #301

@xiki-tempula xiki-tempula linked an issue Apr 2, 2023 that may be closed by this pull request
@xiki-tempula xiki-tempula marked this pull request as draft April 2, 2023 10:49
@xiki-tempula
Copy link
Collaborator Author

@orbeckst Do you mind have a check to see if you are happy with the new logger? How it works with other section of your code. I'm working on the doc now, where I plan to add a new miscellaneous section to the top level doc and a second level logging. Then in other places, I will just refer to this section.

@codecov
Copy link

codecov bot commented Apr 2, 2023

Codecov Report

Merging #303 (3b909bf) into master (1d0a111) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #303      +/-   ##
==========================================
- Coverage   98.75%   98.75%   -0.01%     
==========================================
  Files          27       27              
  Lines        1773     1762      -11     
  Branches      388      388              
==========================================
- Hits         1751     1740      -11     
  Misses          2        2              
  Partials       20       20              
Impacted Files Coverage Δ
src/alchemlyb/estimators/mbar_.py 100.00% <ø> (ø)
src/alchemlyb/convergence/convergence.py 100.00% <100.00%> (ø)
src/alchemlyb/parsing/amber.py 99.15% <100.00%> (-0.01%) ⬇️
src/alchemlyb/parsing/namd.py 99.18% <100.00%> (-0.01%) ⬇️
src/alchemlyb/workflows/abfe.py 99.67% <100.00%> (-0.01%) ⬇️
src/alchemlyb/workflows/base.py 100.00% <100.00%> (ø)

@xiki-tempula xiki-tempula marked this pull request as ready for review April 2, 2023 21:25
@xiki-tempula xiki-tempula requested a review from orbeckst June 1, 2023 19:36
Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments, overall good

docs/miscellaneous/logging.rst Show resolved Hide resolved
=======

In **alchemlyb**, we use :mod:`loguru` for logging. By default, the
:mod:`loguru` will print the logging information into the `stderr`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link to sys.stderr in the Python docs?

from loguru import logger
logger.remove()

Then add other custom sink ::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to a page that explains what the format does, filter etc — basically the docs for logger.add

docs/miscellaneous/logging.rst Show resolved Hide resolved
:func:`scipy.optimize.root`.

verbose : bool, optional
Set to ``True`` if verbose debug output from :mod:`pymbar` is desired.
Output from alchemlyb is logged via :mod:`logging`.
Output from alchemlyb is logged via :mod:`loguru`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove as no logging done here?


.. toctree::
:maxdepth: 2
:caption: Miscellaneous
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove the TOC caption — looks superfluous as it is repeated, see https://alchemlyb--303.org.readthedocs.build/en/303/miscellaneous.html

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, what do you mean by this? I could change the :maxdepth: 2 to 1, if Print to the stderr and Save to a file is superfluous?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see.

@xiki-tempula
Copy link
Collaborator Author

@orbeckst Thanks for the review. I have addressed the changes.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, will just make a minor doc fix before merge

docs/miscellaneous/logging.rst Outdated Show resolved Hide resolved
@xiki-tempula xiki-tempula merged commit ef74784 into master Jun 6, 2023
@xiki-tempula xiki-tempula deleted the 301-using-loguru branch June 6, 2023 19:36
@xiki-tempula xiki-tempula restored the 301-using-loguru branch June 6, 2023 19:36
@xiki-tempula xiki-tempula deleted the 301-using-loguru branch June 6, 2023 19:36
@xiki-tempula xiki-tempula restored the 301-using-loguru branch June 6, 2023 19:36
@xiki-tempula xiki-tempula deleted the 301-using-loguru branch June 6, 2023 19:36
This was referenced Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using loguru
2 participants