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

Logging functionallity #269

Merged
merged 9 commits into from
Aug 30, 2024
Merged

Logging functionallity #269

merged 9 commits into from
Aug 30, 2024

Conversation

kstppd
Copy link
Contributor

@kstppd kstppd commented Aug 28, 2024

So this does loguru as a dep to analysator but makes it so that the verbosity can be controlled by an env flag/

This now uses logging.

  • export ANALYSATOR_LOG_LEVEL=INFO will print what used to be printed
  • export ANALYSATOR_LOG_LEVEL=WARN will silence any prints
  • The default behavior remains unchanged.

print outs now look like so:

INFO:Using matplotlib version 3.7.3
INFO:Note: Unable to switch to TkAgg backend
INFO:Found population proton
INFO:Found population proton

@alhom
Copy link
Contributor

alhom commented Aug 28, 2024

#248 - use built-in logger instead?

@kstppd
Copy link
Contributor Author

kstppd commented Aug 28, 2024

#248 - use built-in logger instead?

This now uses logging and the log level can be set by setting ANALYSATOR_LOG_LEVEL.

Copy link
Contributor

@alhom alhom left a comment

Choose a reason for hiding this comment

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

The comments are still weirded :(

pyPlots/plot_colormap.py Outdated Show resolved Hide resolved
pyPlots/plot_colormap3dslice.py Outdated Show resolved Hide resolved
pyPlots/plot_isosurface.py Outdated Show resolved Hide resolved
@kstppd
Copy link
Contributor Author

kstppd commented Aug 29, 2024

Roger. Wait for an update fixing the comments

pyVlsv/vlsvreader.py Outdated Show resolved Hide resolved
pyVlsv/vlsvreader.py Outdated Show resolved Hide resolved
pyVlsv/vlsvreader.py Outdated Show resolved Hide resolved
@alhom
Copy link
Contributor

alhom commented Aug 30, 2024

This is good. Noting here the logging functions and levels:
https://docs.python.org/3/library/logging.html#logging-levels

So these logging message levels are named, and can be then adjusted to be used. A bit of overlap now with warnings, but those IMO have still their place (since those outputs are non-repeating), not quite sure about these ones.

logging.debug('A DEBUG message')
logging.info('An INFO message')
logging.warning('A WARNING message')
logging.error('An ERROR message')
logging.critical('A CRITICAL message')

@alhom alhom merged commit 5c2c42f into fmihpc:master Aug 30, 2024
6 checks passed
@alhom alhom mentioned this pull request Sep 2, 2024
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.

2 participants