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

add flag to show verbose output and log output under one name #223

Merged
merged 1 commit into from
Apr 4, 2024
Merged

add flag to show verbose output and log output under one name #223

merged 1 commit into from
Apr 4, 2024

Conversation

elfkuzco
Copy link
Contributor

@elfkuzco elfkuzco commented Apr 1, 2024

Rationale

Normalize all log outputs to be under one name instead of module specific loggers and add --debug flag for more verbose output. This is intended to be a fix for #206 .

Changes

  • Initialize logger with default level of INFO instead of DEBUG
  • Add --debug flag to dynamically set level to DEBUG
  • When the --debug flag is set, update the handlers to have their levels set to DEBUG as a simple logger.setLevel(logging.DEBUG) only sets it for the logger and not for the handlers. This is akin to what the getLogger function from zimscraperlib does. After all, it is the handlers that handle output and not the logger object.

@benoit74 benoit74 self-requested a review April 4, 2024 07:32
Copy link

codecov bot commented Apr 4, 2024

Codecov Report

Attention: Patch coverage is 16.66667% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 0.75%. Comparing base (4ac977c) to head (bfd801b).

Files Patch % Lines
src/gutenberg2zim/entrypoint.py 0.00% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #223      +/-   ##
========================================
- Coverage   0.76%   0.75%   -0.01%     
========================================
  Files         15      15              
  Lines       1575    1580       +5     
  Branches     341     343       +2     
========================================
  Hits          12      12              
- Misses      1563    1568       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@benoit74 benoit74 left a comment

Choose a reason for hiding this comment

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

When the --debug flag is set, update the handlers to have their levels set to DEBUG as a simple logger.setLevel(logging.DEBUG) only sets it for the logger and not for the handlers. This is akin to what the getLogger function from zimscraperlib does. After all, it is the handlers that handle output and not the logger object.

You are damn right! Code in offspot/demo I pointed to you is just not working as expected! Thank you!

I amended your commit to add a CHANGELOG entry. Please do not forget (try to at least, I tend to forget as well) next time.

@benoit74 benoit74 merged commit a30026e into openzim:main Apr 4, 2024
7 checks passed
@elfkuzco elfkuzco deleted the normalize-logger branch April 13, 2024 10:10
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