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

Replace print statements with logger #26

Open
wtbarnes opened this issue Sep 27, 2021 · 2 comments
Open

Replace print statements with logger #26

wtbarnes opened this issue Sep 27, 2021 · 2 comments

Comments

@wtbarnes
Copy link
Contributor

There are several places throughout the package that use print statements to output useful information to the screen. Sometimes these are controlled by "debug" or "quiet" arguments. Rather than using these repeated arguments and print statements, we should aim to use a logger (e.g. the builtin logging package) so that the amount of output and the level of severity of these messages (DEBUG, INFO, WARN, ERROR) can easily be controlled by the user.

@MJWeberg
Copy link
Collaborator

Yeah, I have been meaning to refactor everything to use a proper logger. I last setup one up ~6 years ago for a Python 2.7 code, so I will have to brush up on what what has changed since then.

@wtbarnes
Copy link
Contributor Author

I believe the logging module is actually largely unchanged.

However, I'd recommend we use the logger provided by astropy which has a bit of extra functionality. See, for example, how sunpy does this

https://github.com/sunpy/sunpy/blob/62e3f165862879dca7f34a7399f7c1427ed29841/sunpy/__init__.py#L57

https://github.com/sunpy/sunpy/blob/main/sunpy/util/logger.py

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

No branches or pull requests

2 participants