Skip to content

Initial logging library - #1

Merged
thomas-samoht merged 1 commit into
mainfrom
initial-logging-library
Aug 26, 2026
Merged

Initial logging library#1
thomas-samoht merged 1 commit into
mainfrom
initial-logging-library

Conversation

@thomas-samoht

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a complete, self-contained structured-logging library (gfmodules.logging) for GFModules Python projects. Applications declare their loggable events in a catalogue, and the library handles structured JSON records, per-stream field allow-lists (to keep application detail out of SIEM), request-context middleware, correlation-header propagation, and application lifecycle/crash/signal logging. It ships as an initial 0.1.0 release with an optional fastapi/starlette extra, an example FastAPI integration, docs, licensing/REUSE metadata, and CI.

Changes:

  • Core logging engine: event catalogue + validation, emit, per-stream filters/formatters, config builder wiring dictConfig, and a public configure() entry point.
  • Web integration (optional extra): RequestContextMiddleware, exception-handler primitives, per-request context vars, and correlation headers.
  • Extensive test suite, an examples/fastapi_app, starting guide, and project scaffolding (CI, REUSE licensing, Makefile, Dependabot, Sonar).

Reviewed changes

Copilot reviewed 51 out of 56 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
gfmodules/logging/events.py Event/catalogue model, emit, strict-field & reserved-field validation
gfmodules/logging/context.py Per-request context vars, field registration, header sanitisation
gfmodules/logging/middleware.py Request-context middleware, access logging, body capture, context rebinding
gfmodules/logging/config_builder.py / config.py Builds the dictConfig document; pydantic settings model
gfmodules/logging/formatter.py / filters.py JSON/plain formatters with per-stream allow-list; stream filters
gfmodules/logging/lifecycle.py Startup/stopped/crashed events, excepthook, signal handlers
gfmodules/logging/loggers.py / registry.py / streams.py Logger-root management, catalogue registry, stream enum
gfmodules/logging/__init__.py / testing.py Public API + configure(); test helpers (capture/assert)
tests/**, examples/** Comprehensive unit/e2e tests and a worked FastAPI example
pyproject.toml, Makefile, .github/**, REUSE.toml, docs/**, README.md Packaging, CI, licensing, and documentation

One issue was flagged: a grammatically broken strict-fields error message in events.py that should read clearly since it is what surfaces field typos to developers. The rest of the code is cohesive and well-tested; dependency version pins (e.g. starlette >=1.3, httpx2, pydantic 2.12.5) and future-dated GitHub Action majors could not be conclusively verified but were not flagged.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread gfmodules/logging/events.py Outdated
@thomas-samoht
thomas-samoht force-pushed the initial-logging-library branch from 26051ca to df68bb1 Compare August 25, 2026 10:51
@thomas-samoht
thomas-samoht force-pushed the initial-logging-library branch from df68bb1 to d0cd9b9 Compare August 25, 2026 14:09
@thomas-samoht
thomas-samoht marked this pull request as ready for review August 25, 2026 15:07
@thomas-samoht
thomas-samoht requested a review from a team as a code owner August 25, 2026 15:07
@thomas-samoht
thomas-samoht merged commit fbfdd2e into main Aug 26, 2026
14 checks passed
@thomas-samoht
thomas-samoht deleted the initial-logging-library branch August 26, 2026 08:53
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.

3 participants