Skip to content

Setup Python logging with configurable verbosity#21

Merged
frizzleqq merged 2 commits intomainfrom
copilot/setup-python-logging-configuration
Jan 6, 2026
Merged

Setup Python logging with configurable verbosity#21
frizzleqq merged 2 commits intomainfrom
copilot/setup-python-logging-configuration

Conversation

Copy link
Contributor

Copilot AI commented Jan 6, 2026

Configures Python logging for the project with a structured format and CLI-controlled verbosity.

Changes

Logging configuration (src/dab_project/logging_config.py)

  • Centralized setup_logging() function with format: YYYY-MM-DD HH:MM:SS,mmm - LEVEL - module - message
  • INFO level by default; DEBUG when verbose flag enabled
  • Console handler on stdout (extensible for future file logging)

CLI integration (src/dab_project/cli.py)

  • Added -v/--verbose flag to enable DEBUG logging
  • Replaced print() error handling with logger.error()
  • Calls setup_logging() on startup

Example output

# Without -v flag (INFO level)
$ dab-project InvalidTask
2026-01-06 10:26:52,599 - ERROR - dab_project.cli - Error with component 'InvalidTask': Unknown Task...

# With -v flag (DEBUG level)
$ dab-project -v BronzeTaxiTask
2026-01-06 10:27:15,123 - INFO - dab_project.tasks.base_task - Starting ETL task: BronzeTaxiTask
2026-01-06 10:27:15,124 - DEBUG - dab_project.tasks.base_task - Task class: dab_project.tasks.bronze_nyctaxi.BronzeTaxiTask

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • astral.sh
    • Triggering command: /usr/bin/curl curl -LsSf REDACTED (dns block)
  • repos.spark-packages.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -cp hive-jackson/*:/home/REDACTED/work/databricks-bundle-implementation/databricks-bundle-implementation/.venv/lib/python3.12/site-packages/pyspark/conf:/home/REDACTED/work/databricks-bundle-implementation/databricks-bundle-implementation/.venv/lib/python3.12/sit /tmp/cciIv9rb.s (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Setup Python logging</issue_title>
<issue_description>Currently we do not configure how the Python project handles logging.
I want logs to look like this example I found 2025-04-23 10:35:42,789 - INFO - auth - User login successful.
By default, INFO (and higher) should be logged. DEBUG should only be logged if we add the cli flag -v.
Send logs to console only for now, but consider that we may log to files in the future.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: frizzleqq <6024093+frizzleqq@users.noreply.github.com>
Copilot AI changed the title [WIP] Setup Python logging configuration for project Setup Python logging with configurable verbosity Jan 6, 2026
Copilot AI requested a review from frizzleqq January 6, 2026 10:27
@frizzleqq frizzleqq marked this pull request as ready for review January 6, 2026 10:45
@frizzleqq frizzleqq merged commit be66003 into main Jan 6, 2026
3 checks passed
@frizzleqq frizzleqq deleted the copilot/setup-python-logging-configuration branch January 6, 2026 10:46
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.

Setup Python logging

2 participants