Repository navigation
Replace application prints and bare excepts with logging - #593
Merged
Merged
Conversation
Application print calls now go through logging.getLogger(__name__). Bare excepts in the dump download and Geonames update catch Exception, so SystemExit and KeyboardInterrupt are not swallowed. Co-authored-by: Joseph Rhoads <jrhoads@users.noreply.github.com>
cursor
Bot
force-pushed
the
quickwin/logging
branch
from
September 30, 2026 15:55
4e4ce2a to
c1df708
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Send application trace output through the logging system, and stop bare
exceptclauses from swallowingSystemExitandKeyboardInterrupt.Approach
Replace
print()in application modules withlogging.getLogger(__name__). Leave test progress output asprint(). Replace the bareexcept:clauses ingetrordump.pyandcreate_update.pywithexcept Exception. Add a console handler for therorapilogger at INFO so those messages still show up the way the prints did.Key Modifications
print()calls in views, CSV create/update/bulk helpers, record validation, setup, and record create/update.DATA_STOREnotice withlogger.warning.Exceptioninstead of a bareexceptwhen reading a GitHub dump response, saving the dump zip, and looking up a Geonames id.rorapilogger to write INFO messages to the console.Important Technical Details
except Exceptiondoes not catchSystemExit. The dump zip check that raisesSystemExitwhen the archive contains an extra directory now reaches the caller instead of being replaced with "Something went wrong saving zip file".print()for progress and score output.printines_utils.pyis unchanged.LOGGINGentry does, without changing thedjangologger.Types of changes
Test plan
tests_uniton this PRReviewer, please remember our guidelines: