Skip to content

chore: added context to log statements - #1905

Open
2028bxi wants to merge 4 commits into
tjcsl:devfrom
2028bxi:dev
Open

2028bxi wants to merge 4 commits into
tjcsl:devfrom
2028bxi:dev

Conversation

@2028bxi

@2028bxi 2028bxi commented May 15, 2026

Copy link
Copy Markdown

Proposed changes

  • Added additional context to log statements
  • Removed unnecessary logs

Brief description of rationale

Closes #729

@coveralls

coveralls commented May 15, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 79.242% (-0.01%) from 79.252% — 2028bxi:dev into tjcsl:dev

@2028bxi

2028bxi commented May 15, 2026

Copy link
Copy Markdown
Author

Mythofs is my other account

@2028bxi
2028bxi marked this pull request as ready for review May 15, 2026 02:06
@2028bxi
2028bxi requested a review from a team as a code owner May 15, 2026 02:06

@aarushtools aarushtools left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi Bryan,

Good start on your PR, can you just review the comments I added? Thanks!
Also just to be sure you covered most of these cases, what was your process for finding them?

self.stdout.write(str(usr.delete()))
username = usr.username
delete_count, deleted_objects = usr.delete()
self.stdout.write(f"Deleted user {username}, {delete_count} objects deleted {deleted_objects}")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you show an example of what this output looks like? I am worried this will be unnecessarily long

@2028bxi 2028bxi May 17, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It will output something like this, but deleted_objects will probably be a lot longer for actual users:
Deleted user 2026banderso, 2 objects deleted {'users.Email': 1, 'users.User': 1}
Deleted user 2026dbaker, 2 objects deleted {'users.Email': 1, 'users.User': 1}
Deleted user 2026abrown, 2 objects deleted {'users.Email': 1, 'users.User': 1}

To make it more compact, deleted_objects could be removed.

Comment thread scripts/build_docs.py Outdated
Comment thread scripts/build_docs.py Outdated
@2028bxi

2028bxi commented May 17, 2026

Copy link
Copy Markdown
Author

To find log statements, I ran this command:
Get-ChildItem -Recurse -Filter "*.py" | Select-String -SimpleMatch "print(", "sys.stdout", "sys.stderr", "self.stdout", "logger.debug", "logger.info", "logger.warning", "logger.error", "logger.exception"

I wasn't sure if I had to add context to error logs so I ignored them

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.

Add additonal context to logging statements.

4 participants