Skip to content

v2.24.1 - Logging & Code Quality

Choose a tag to compare

@btoron btoron released this 05 Mar 00:06
· 37 commits to master since this release
9d5200d

$(cat <<'EOF'

pyOFSC v2.24.1 - Logging & Code Quality

Release Date: March 4, 2026


🎯 New Features

Request/Response Logging (#110)

Optional httpx event hooks for automatic API call tracing on the async client:

import logging
logging.basicConfig(level=logging.DEBUG)

async with AsyncOFSC(clientID="...", secret="...", companyName="...", enable_logging=True) as client:
    workzones = await client.metadata.get_workzones()
    # DEBUG: Request: GET https://company.fs.ocs.oraclecloud.com/rest/ofscMetadata/v1/workZones
    # DEBUG: Response: GET ...  200
  • Logs under ofsc.async_client logger
  • HTTP errors (4xx/5xx) logged at WARNING level
  • Disabled by default with zero overhead

🐛 Bug Fixes

baseUrl validation in async modules (#150)

core/_base.py and oauth.py could return None from baseUrl, causing cryptic urljoin(None, ...) errors. Now raises ValueError("Base URL is not configured") matching the pattern in capacity.py and statistics.py.

Security: OAuth token leak removed

Removed print() statement in ofsc/models/_base.py that printed the OAuth bearer token to stdout.


🔧 Improvements

Named loggers across library code

Replaced root logger (logging.debug(...)) with named loggers (logger = logging.getLogger(__name__)) in:

  • ofsc/common.py
  • ofsc/core.py
  • ofsc/models/_base.py
  • ofsc/async_client/__init__.py

Pagination logging downgraded to DEBUG

5 INFO-level log calls in get_all_activities and get_all_properties pagination loops downgraded to DEBUG.

Removed leftover print statements

Removed 2 debug print() calls in ofsc/core.py (create_resource_location, get_all_activities).

README improvements

Updated README with clearer usage examples for both sync and async clients.


📊 Test Coverage

  • 447 tests passing (6 new logging tests)
  • Zero pydantic deprecation warnings

Files Changed

File Changes
ofsc/async_client/__init__.py enable_logging param, event hooks, named logger
ofsc/async_client/core/_base.py baseUrl None validation
ofsc/async_client/oauth.py baseUrl None validation
ofsc/common.py Named logger
ofsc/core.py Named logger, remove prints, DEBUG pagination
ofsc/models/_base.py Named logger, remove token print
tests/async/test_async_ofsc.py 6 new logging tests
README.md Updated usage examples and logging docs
EOF
)