Skip to main content

br_logging_and_profiling

Reusable logging/profiling/tracing package extracted from Forecasting-sidecar3.

Current state

  • Logging: Loguru + colorama via br_py_log_n_profile.do_log.log_it
  • Profiling: profile_it decorator (wall-clock timing, colored console output)
  • Correlation IDs: ray_id via contextvars.ContextVar

Planned

  • tracing/ module: init_tracing(), traced decorator (OTel span replacement for profile_it), @counted/@timed_metric for hot-loop metrics
  • Backend: Prometheus + Jaeger + Grafana + OTel Collector
  • Migration phases: Phase 0 (deps/config) → Phase 1 (core tracing) → Phase 2 (migrate by layer) → Phase 3 (metrics) → Phase 4 (backend stack)

Install

pip install br-logging-and-profiling

Development

Clone with submodules, or initialize the shared pre-commit tooling after cloning:

git submodule update --init --recursive
pip install -r requirements-dev.txt
bash br_pre_commit/install.sh "$PWD"
./pre-commit
pytest -m unit

The pre-commit gate runs strict mypy against examples/, including the profile_it type-preservation example.

Importer note: break_on_not_tested breakpoint

log_w(NOT_TESTED) intentionally triggers breakpoint() by default to flag untested code paths during interactive development. Under pytest this aborts tests with bdb.BdbQuit unless the breakpoint is disabled first.

Always disable it in your test configuration before running pytest:

from br_py_log_n_profile.do_log.log_it import configure

configure(break_on_not_tested=False)

This repo does this automatically in tests/conftest.py. If you import this package into your own project, add the same call to your conftest.py (or set PYTHONBREAKPOINT=0) to avoid test failures.

Changelog

[0.6.2] - 2026-09-14

Added

Changed

Fixed

  • fd436be (HEAD -> main, origin/main, origin/feat/not-tested-pause-breakpoint, origin/HEAD, feat/not-tested-pause-breakpoint) chore(deps): update br_pre_commit submodule
  • 7ab2ccd docs: document and disable breakpoint for "not tested" warnings
  • b695fce fix(do_log): add breakpoint trigger for "Not tested!" warning messages
  • 9d513af (origin/refactor/migrate-release-tooling-to-submodule, refactor/migrate-release-tooling-to-submodule) chore(deps): update br_pypi_publisher submodule to 49f8081
  • 73de132 refactor: migrate release tooling to submodule and cleanup scripts
  • 53aa6cd (origin/feat/log_exception, feat/log_exception) chore(scripts): replace bash release script with python implementation
  • efb1191 ci(release): implement automated GitHub Actions release workflow
  • ae5c734 chore: release v0.5.2
  • bf65cb6 build: bump version to 0.5.1
  • e162665 chore(profiling): update version comment to 0.6.0
  • 11f80ba docs(examples): add decorated version of format_value to profile_it_type_preservation
  • d086869 ci(dev): implement pre-commit workflow and typing verification
  • 149037d chore: release v0.5.0
  • a0165b4 chore: release v0.4.0
  • 3ccac3e build(release): bump version to 0.3.0 and update publishing script
  • d490196 feat(do_log): add log_exception function
  • 0263bac chore: release v0.2.0
  • d07de79 fix(profiling): preserve decorated signatures
  • 76a964e feat: allow SKIP_NO_COMMIT_TO_MAIN env var for automated releases
  • 8eaa318 chore: release v0.1.1
  • e7c72e3 docs: update migration report with PyPI publication and Forecasting-sidecar3 dependency update
  • 345a752 docs: add detailed migration report
  • 5e1c1fd docs: update CHANGELOG with detailed 0.1.0 release notes
  • 79c7c8e feat: add unit tests for br_py_log_n_profile and fix pre-commit formatting
  • 40edcd0 chore: remove Forecasting-sidecar3-specific project-decisions skill from all agent mirrors
  • 32ff2a4 feat: initial project scaffold with package, pre-commit, tests, and skills
  • 67463aa first commit

[0.6.1] - 2026-09-14

Added

Changed

Fixed

  • fd436be (HEAD -> main, origin/main, origin/feat/not-tested-pause-breakpoint, origin/HEAD, feat/not-tested-pause-breakpoint) chore(deps): update br_pre_commit submodule
  • 7ab2ccd docs: document and disable breakpoint for "not tested" warnings
  • b695fce fix(do_log): add breakpoint trigger for "Not tested!" warning messages
  • 9d513af (origin/refactor/migrate-release-tooling-to-submodule, refactor/migrate-release-tooling-to-submodule) chore(deps): update br_pypi_publisher submodule to 49f8081
  • 73de132 refactor: migrate release tooling to submodule and cleanup scripts
  • 53aa6cd (origin/feat/log_exception, feat/log_exception) chore(scripts): replace bash release script with python implementation
  • efb1191 ci(release): implement automated GitHub Actions release workflow
  • ae5c734 chore: release v0.5.2
  • bf65cb6 build: bump version to 0.5.1
  • e162665 chore(profiling): update version comment to 0.6.0
  • 11f80ba docs(examples): add decorated version of format_value to profile_it_type_preservation
  • d086869 ci(dev): implement pre-commit workflow and typing verification
  • 149037d chore: release v0.5.0
  • a0165b4 chore: release v0.4.0
  • 3ccac3e build(release): bump version to 0.3.0 and update publishing script
  • d490196 feat(do_log): add log_exception function
  • 0263bac chore: release v0.2.0
  • d07de79 fix(profiling): preserve decorated signatures
  • 76a964e feat: allow SKIP_NO_COMMIT_TO_MAIN env var for automated releases
  • 8eaa318 chore: release v0.1.1
  • e7c72e3 docs: update migration report with PyPI publication and Forecasting-sidecar3 dependency update
  • 345a752 docs: add detailed migration report
  • 5e1c1fd docs: update CHANGELOG with detailed 0.1.0 release notes
  • 79c7c8e feat: add unit tests for br_py_log_n_profile and fix pre-commit formatting
  • 40edcd0 chore: remove Forecasting-sidecar3-specific project-decisions skill from all agent mirrors
  • 32ff2a4 feat: initial project scaffold with package, pre-commit, tests, and skills
  • 67463aa first commit

[0.6.0] - 2026-09-14

Added

Changed

Fixed

  • fd436be (HEAD -> main, origin/main, origin/feat/not-tested-pause-breakpoint, origin/HEAD, feat/not-tested-pause-breakpoint) chore(deps): update br_pre_commit submodule
  • 7ab2ccd docs: document and disable breakpoint for "not tested" warnings
  • b695fce fix(do_log): add breakpoint trigger for "Not tested!" warning messages
  • 9d513af (origin/refactor/migrate-release-tooling-to-submodule, refactor/migrate-release-tooling-to-submodule) chore(deps): update br_pypi_publisher submodule to 49f8081
  • 73de132 refactor: migrate release tooling to submodule and cleanup scripts
  • 53aa6cd (origin/feat/log_exception, feat/log_exception) chore(scripts): replace bash release script with python implementation
  • efb1191 ci(release): implement automated GitHub Actions release workflow
  • ae5c734 chore: release v0.5.2
  • bf65cb6 build: bump version to 0.5.1
  • e162665 chore(profiling): update version comment to 0.6.0
  • 11f80ba docs(examples): add decorated version of format_value to profile_it_type_preservation
  • d086869 ci(dev): implement pre-commit workflow and typing verification
  • 149037d chore: release v0.5.0
  • a0165b4 chore: release v0.4.0
  • 3ccac3e build(release): bump version to 0.3.0 and update publishing script
  • d490196 feat(do_log): add log_exception function
  • 0263bac chore: release v0.2.0
  • d07de79 fix(profiling): preserve decorated signatures
  • 76a964e feat: allow SKIP_NO_COMMIT_TO_MAIN env var for automated releases
  • 8eaa318 chore: release v0.1.1
  • e7c72e3 docs: update migration report with PyPI publication and Forecasting-sidecar3 dependency update
  • 345a752 docs: add detailed migration report
  • 5e1c1fd docs: update CHANGELOG with detailed 0.1.0 release notes
  • 79c7c8e feat: add unit tests for br_py_log_n_profile and fix pre-commit formatting
  • 40edcd0 chore: remove Forecasting-sidecar3-specific project-decisions skill from all agent mirrors
  • 32ff2a4 feat: initial project scaffold with package, pre-commit, tests, and skills
  • 67463aa first commit

[0.5.2] - 2026-09-09

Added

Changed

Fixed

[0.5.1] - 2026-09-09

Added

Changed

Fixed

[0.5.0] - 2026-09-09

Added

Changed

Fixed

[0.4.0] - 2026-09-08

Added

Changed

Fixed

[0.3.0] - 2026-09-08

Added

Changed

Fixed

[0.2.1] - 2026-09-08

Added

Changed

Fixed

[0.2.0] - 2026-09-06

Added

Changed

Fixed

[0.1.1] - 2026-09-05

Added

Changed

Fixed

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[0.1.0] - 2026-09-05

Added

  • Initial package structure extracted from Forecasting-sidecar3/app/helper/logging/
  • br_py_log_n_profile.do_log.log_it — Loguru-based logging facade with Loguru + colorama + stdlib logging interception
  • br_py_log_n_profile.do_log.ray_id — ContextVar-based correlation ID (get_ray_id, set_ray_id, ray_id)
  • br_py_log_n_profile.profiling.base — profile_it timing decorator with color-coded duration buckets
  • Package-level re-exports in br_py_log_n_profile.__init__ preserving the legacy helper.logging public surface
  • pyproject.toml with ruff/mypy/pytest config matching Forecasting-sidecar3 standards
  • Pre-commit hooks (ruff format/lint, mypy, pytest unit gate, skill-file sync)
  • Incremental ratchet gate for mypy/ruff/loc
  • Contract tests validating installed package public API surface
  • Compatibility shims in Forecasting-sidecar3/app/helper/logging/ re-exporting from installed package
  • Wheel/sdist build artifacts in dist/

Changed

  • Forecasting-sidecar3 app/helper/logging/ modules now re-export from br_py_log_n_profile instead of containing original implementations
  • All legacy import paths (from helper.logging import ..., from helper.logging.do_log import ..., etc.) continue to work unchanged
  • Forecasting-sidecar3 pytest.ini registers contract marker for new contract tests

Fixed

  • numpy constraint pinned to <2.2 for TensorFlow 2.19.0 compatibility

Metadata

Release files for br-logging-and-profiling 0.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for br-logging-and-profiling 0.6.2
File Size Uploaded Provenance Actions
br_logging_and_profiling-0.6.2.tar.gz 8.6 kB Without provenance Details for br_logging_and_profiling-0.6.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for br-logging-and-profiling 0.6.2
File Interpreter ABI Platform Actions
br_logging_and_profiling-0.6.2-py3-none-any.whl Python 3 none any Details for br_logging_and_profiling-0.6.2-py3-none-any.whl

Total release size: 17.5 kB

Release files / br_logging_and_profiling-0.6.2.tar.gz

Download URL br_logging_and_profiling-0.6.2.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
aae9ba8c951de6785773bccede7ca017d7188e8419a3cf937880de84c60fbe74
BLAKE2b-256 checksum
How to use checksums
33ad9e2bc723a23d5be9d7999836f44cb785c0229a01b8ad96ac7d6053502de4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Release files / br_logging_and_profiling-0.6.2-py3-none-any.whl

Download URL br_logging_and_profiling-0.6.2-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
161aea542ab158aa6fdd413e64ba3524793f92416678420ed7c80954e5003ec9
BLAKE2b-256 checksum
How to use checksums
fbe5b2f38ea76035b07c65e583230704500eed229b9f06b7466d1258d56750da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Security for br-logging-and-profiling 0.6.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page