Skip to content

Fix logging output routing and added colorized logging (#205, #206) - #210

Merged
TimidRobot merged 1 commit into
creativecommons:mainfrom
SaurabhCodesAI:main
Oct 28, 2025
Merged

Fix logging output routing and added colorized logging (#205, #206)#210
TimidRobot merged 1 commit into
creativecommons:mainfrom
SaurabhCodesAI:main

Conversation

@SaurabhCodesAI

@SaurabhCodesAISaurabhCodesAI commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

Fixes

Description

Fixed logging output routing so info/warning messages go to stdout and errors go to stderr. Also added colors to log messages so they're easier to read in the terminal.

Technical details

Replaced basicConfig() with dual handlers for proper output routing, then added a ColoredFormatter class with the ANSI color codes.

Tests

Run python scripts/1-fetch/gcs_fetch.py --help and you'll see colored log output routed correctly.

Screenshots

Checklist

  • I have read and understood the Developer Certificate of Origin (DCO), below, which covers the contents of this pull request (PR).
  • My pull request doesn't include code or content generated with AI.
  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main or master).
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

For the purposes of this DCO, "license" is equivalent to "license or public domain dedication," and "open source license" is equivalent to "open content license or public domain dedication."

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

@SaurabhCodesAI
SaurabhCodesAI requested review from a team as code ownersOctober 22, 2025 00:35
@SaurabhCodesAI
SaurabhCodesAI requested review from TimidRobot and possumbilities and removed request for a teamOctober 22, 2025 00:35
@cc-open-source-botcc-open-source-bot moved this to In review in TimidRobotOct 22, 2025
@SaurabhCodesAISaurabhCodesAI changed the title Fix logging output routingFix logging output routing and added colorized logging (#205, #206)Oct 22, 2025
@SaurabhCodesAI

Copy link
Copy Markdown
ContributorAuthor

About the basicConfig thing, I tried keeping it at first but it messed with the new handlers, so I just replaced it entirely.

Used a dictionary for the colors since it was easier than a bunch of if statements.

Did both issues together since #206 needed #205 done first anyway.

Thanks @TimidRobot for the clear issue descriptions, made it much easier to understand what was needed!

@TimidRobotTimidRobot self-assigned this Oct 22, 2025

@TimidRobotTimidRobot 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.

Great work!

A couple of the comments are asking you to fix my own mistakes 🙃

Testing this was made a little more difficult due to the branch/PR being out of date (not synchronized with main). I suspect this is also why the changes to the update_readme function were included.

Comment threadscripts/shared.py
Comment threadscripts/shared.py Outdated
Comment threadscripts/shared.py Outdated
Comment threadscripts/shared.py Outdated
@TimidRobot

TimidRobot commented Oct 22, 2025

Copy link
Copy Markdown
Member
  • I added or updated tests for the changes I made (if applicable).

Which tests did you add or update?

  • I added or updated documentation (if applicable).

What documentation did you update?

@SaurabhCodesAI

Copy link
Copy Markdown
ContributorAuthor
  • I added or updated tests for the changes I made (if applicable).

Which tests did you add or update?

  • I added or updated documentation (if applicable).

What documentation did you update?

I apologize, I missed the "(if applicable)" part and checked those boxes without thinking. I'm still learning the open source contribution process and will be more careful with the checklist. Thanks for your valuable guidance.

Updated WARNING and ERROR codes to use the correct foreground colors.
Added Wikipedia reference comment above COLORS.
@SaurabhCodesAI

Copy link
Copy Markdown
ContributorAuthor

Hey, @TimidRobot Fixed all the issues you mentioned:
Updated WARNING to code 93 (bright yellow foreground)
Updated ERROR to code 91 (bright red foreground)
Added Wikipedia ANSI reference comment above COLORS
Synced fork with latest main

i myself Tested locally and confirmed the colors display correctly.

@TimidRobotTimidRobot 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.

This will be helpful, thank you!

@TimidRobot
TimidRobot merged commit 24b7803 into creativecommons:mainOct 28, 2025
@github-project-automationgithub-project-automationBot moved this from In review to Done in TimidRobotOct 28, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Colorize logging based on log level Logging outputs to stderr instead of stdout

3 participants

@SaurabhCodesAI@TimidRobot@cc-open-source-bot