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

Issue #106: Implement logging module #107

Merged
merged 3 commits into from
Dec 23, 2023
Merged

Issue #106: Implement logging module #107

merged 3 commits into from
Dec 23, 2023

Conversation

Mark2000
Copy link
Contributor

Description

Closes #106

Implements the python logging module. @LorenzzoQM would be interested to hear your opinions about if we should log less/more and what logging levels are appropriate. There's a lot that could be done here, like coloring logs, etc. but this feels like a good minimal product.

How should this pull request be reviewed?

  • By commit
  • All changes at once

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

Updated tests.

  • Unit tests (General Environment only) pytest --cov bsk_rl/envs/general_satellite_tasking --cov-report term-missing tests/unittest
  • Integrated tests (General Environment only) pytest --cov bsk_rl/envs/general_satellite_tasking --cov-report term-missing tests/integration

Test Configuration

  • Python: 3.10.11
  • Basilisk: 2.2.2
  • Platform: MacOS

Checklist:

  • My code follows the style guidelines of this project (passes Black, ruff, and isort)
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Commit messages are atomic, are in the form Issue #XXX: Message and have a useful message
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@Mark2000 Mark2000 requested a review from LorenzzoQM December 22, 2023 23:05
@Mark2000 Mark2000 force-pushed the feature/106-logging branch from b71ab21 to 54a01e2 Compare December 23, 2023 07:57
@Mark2000
Copy link
Contributor Author

Pushed fixes that should eliminate erroneous logging. Also fixed the logger when multiple environments are instantiated, sequentially, could still be a problem in parallel applications, like training. Will read up on logging filters and think about it more.

@Mark2000 Mark2000 force-pushed the feature/106-logging branch from 54a01e2 to a3ee5ee Compare December 23, 2023 08:05
@Mark2000 Mark2000 force-pushed the feature/106-logging branch from a3ee5ee to c2a0996 Compare December 23, 2023 15:11
Copy link
Contributor

@LorenzzoQM LorenzzoQM left a comment

Choose a reason for hiding this comment

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

I agree with the three log levels; for now, I think they are enough. I also agree with the amount of information being logged at each level. Over time, we can add more if we see it as necessary. This is an excellent feature to have!

@@ -0,0 +1,21 @@
import logging

sim_format = logging.Formatter(
Copy link
Contributor

@LorenzzoQM LorenzzoQM Dec 23, 2023

Choose a reason for hiding this comment

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

Do you think adding a color scheme would be interesting to make it easier to identify when it is INFO, DEBUG, or WARNING? Something like blue, brown, and yellow would help (maybe just the words info, debug, and warning), especially when debugging when we have a lot of info (if it is not too much work now).

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, is it worth adding the option to save the log in a file? I can see some cases where it might be useful and easier to use the file than the terminal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lol I was already working on color scheme when you said this, this is what I just pushed. Not shown in the pic are colors for warnings (yellow) and errors (red)
Screenshot 2023-12-23 at 8 46 18 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was considering adding to-file logging, should be pretty easy I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

Excellent! The colors look nice!

@Mark2000 Mark2000 merged commit 6e973ea into develop Dec 23, 2023
@Mark2000 Mark2000 deleted the feature/106-logging branch December 23, 2023 17:02
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.

Use python logging module
2 participants