Skip to content

Conversation

AustinCullar
Copy link
Owner

@AustinCullar AustinCullar commented Oct 15, 2024

Overview

The Logger class is now named AstroLogger, and properly inherits from the main logging.Logger class.

Rich logging theme

A project color theme is now defined and used in logging, which looks much better. Here's an example of how each log level looks now:
Screenshot 2024-10-15 at 3 16 43 PM

A full run with logging set to debug can be seen below:
Screenshot 2024-10-15 at 3 43 31 PM

Progress bars

The AstroProgress class is now purely leveraged/wrapped by the AstroLogger class. So any logic wanting to use a progress bar can create it by writing:

with self.logger.progress_bar('Description', steps) as progress:
    ...
    while working:
        ...
        progress.advance(steps)

    progress.complete()  # only necessary if you aren't guaranteed to complete all steps

- Defined a custom project theme for logging colors
- AstroLogger now properly inherits from the main Logger class, extending its functionality
- AstroLogger.progress_bar() method has been added, through which external modules can create/manage progress bars
- AstroLogger.print_object() method has been added to print video metadata, but will also help in debugging
- AstroLogger.print_dataframe() method has been added to print dataframes in a rich table
- Logging from google will now be supressed to the WARNING level, to avoid irrelevant or overly verbose logging
- Modify conftest.py to account for new AstroLogger structure
- Add some dummy tests for new functions to be implemented later
@AustinCullar AustinCullar added enhancement New feature or request logging Changes to logging functionality labels Oct 15, 2024
@AustinCullar AustinCullar self-assigned this Oct 15, 2024
@AustinCullar AustinCullar linked an issue Oct 15, 2024 that may be closed by this pull request
- Created test_objects.py file to hold lists of data structures for tests
    - This now houses VideoData structure list since astro_db and log tests now use it
- Add check for None in print_object() method
Copy link

Code Coverage

Package Line Rate Health
src 89%
src.data_collection 92%
src.tests 97%
Summary 93% (607 / 651)

Minimum allowed line rate is 70%

@AustinCullar AustinCullar merged commit db56158 into main Oct 16, 2024
1 check passed
@AustinCullar AustinCullar deleted the 49-improve-logging-with-the-rich-module branch October 16, 2024 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request logging Changes to logging functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve logging with the rich module
1 participant