Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

log-foundry

Latest version: v1.3.0

Overview

Last scanned
29 Nov 2026
Published
29 Nov 2026
PyPI package Publisher: agriffi11
1 Stars
0 Forks
4 Versions
1.6K Downloads
Python Repo language

Scan summary

log-foundry was last scanned on 29 Nov 2026 at version 1.3.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 4 versions; the latest was published on 29 Nov 2026.
  • Findings: No rules fired in version 1.3.0.
  • Downloads: 1,567 downloads.

Versions

4 versions published
Versions and the rules that fired in each
VersionPublishedStatus
1.3.0 LATEST 29 Nov 2026 No rules fired
1.2.0 14 Nov 2026 No rules fired
1.1.0 5 Nov 2026 No rules fired
1.0.2 3 Nov 2026 Not shown

No rules fired in 1.3.0

Findings

Findings for v1.3.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 1.3.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

Log Foundry

PyPI Python Build License

Consistent, structured (JSON) logs for every decorated function call — correlated by shared trace/span IDs, ready to ship to any of 30-plus built-in sinks (stdout by default; SQS → ELK is the headline production path).

log-foundry owns the logs pillar of observability. You decorate a function with @trace; it emits one identically-shaped JSON record when the call starts and another when it ends (with duration and status), stitched together by W3C-compatible trace and span IDs so nested calls form a tree you can query later.

  • Zero runtime dependencies — the core pulls in nothing; every sink that needs a third-party client (boto3, kafka, redis, …) sits behind its own optional extra, lazily imported.
  • Fully typed — mypy --strict, ships a PEP 561 py.typed marker.
  • Structured, never free-form — every event is the same named-field JSON shape.
  • Safe by default — never captures your arguments or return values (no accidental PII/secret leakage), and the decorator never swallows exceptions.
  • Correct under threads and asyncio — context propagates via contextvars.
  • Non-blocking delivery from a traced call — a span's events are handed to a background worker, about once a second while the span is open and the rest when it closes, so code inside @trace never blocks on sink I/O, and a graceful drain at exit means buffered events aren't lost. Two things you can do deliberately are synchronous: a level call with no open span, which emits on your own thread, and flush(), which by definition waits for the drain it asked for.

The public API is frozen for the whole of 1.x. Everything in log_foundry.__all__, the Sink protocol, and every shipped sink class at the import path documented for it below — together with the public names those signatures use, such as GroupIdSource, DedupIdSource and Backend — stays put: nothing is removed, renamed or moved, and no signature changes in a way that breaks a caller, until 2.0.0. The import path is part of that promise because it has to be — no concrete sink is exported from the top level, so from log_foundry.sinks.sqs import SQSSink is the only way to reach one, and a class pinned at a path free to move is not pinned at all. 1.0.0 is where they last moved; the upgrade note below says which.

Behaviour is not frozen by that promise — a defect is still a defect, and fixing one can change what a broken path does. The private half is genuinely private: underscore-prefixed modules — _lifecycle, _fork, _diag, and the sinks/_*.py helpers — move without notice.

1.0.0 was a reliability release rather than a feature release: three audit arcs worked through the paths where the library could lose an event, fail its caller, block forever, or report health it could not back up. If you are coming from any 0.x, read its release notes before you bump — several of the changes are silent, and they are written against 0.10.1, the release immediately before this one: docs/release-notes/v1.0.0.md. CHANGELOG.md indexes every version.


Requirements

  • Python ≥ 3.12 — the full gate (ruff, mypy, pytest) runs on 3.12 and 3.13 in CI.

Installation

Published on PyPI as log-foundry:

pip install log-foundry           # core, zero dependencies
pip install 'log-foundry[aws]'    # + boto3 for the SQS/SNS/Kinesis/Firehose sinks
pip install 'log-foundry>=1,<2'   # pin to the frozen API above

Breaking in 1.0.0, if you are upgrading from any 0.x. Three public shapes changed once, in the release that froze the API, because none of them could have been changed afterwards without a major version:

  • health() and sink.losses() return frozen dataclasses, not NamedTuples. Attribute access (h.dropped, losses.failed) is unchanged and is the whole contract; len(h), h[0] and the four-way queued, dropped, failed_batches, stopped_reason = health() now raise TypeError. Health gains fields, and will gain more — with no positions to preserve, that stops being a breaking change.
  • flush() returns a FlushResult and continue_trace() a ContinueResult, each truthy or falsy with a reason naming why. if lf.flush(): is unchanged; lf.flush() is True is not — the result is an object. A one-bit return could not grow a reason later without silently changing what if flush(): means, which is why it moved before the freeze.
  • SQSSink's injected client is keyword-only (SQSSink(queue_url, client=…)), SentrySink injects through client= rather than the old sdk keyword, with no alias, and the sink attribute the library assigns for interruptible backoff is log_foundry_stop_signal, not stop_signal — a prefixed name cannot silently overwrite one your own sink already uses. Since 1.3.0 that event is its own, one per sink: it is set when a shutdown starts, stays set for a delivery after it, and is cleared when configure() installs it again.

Those are the three changes of shape, and not the three most likely to reach you: log_foundry.sinks.util was deleted with no alias — the MemorySink, NullSink and StderrSink it held are now at log_foundry.sinks.memory, …null and …stdout — and several new construction-time refusals land, all of which rank above two of the three above in the release notes' own ordering. Read the full list of twenty-two before you upgrade — docs/release-notes/v1.0.0.md.

echo, message and fields are reserved parameter names on the emitters; pass fields of those names through fields={...}, which also takes keys that are not Python identifiers.

Why log-foundry, when the repository is log-forge. The distribution and the import package match each other — pip install log-foundry, then import log_foundry. The project was originally called log-forge, but PyPI rejects that name as too similar to the unrelated, pre-existing logforge project — its similarity check collapses separators, so log-forge and logforge count as the same name. Rather than keep a distribution and an import name that disagreed, everything became log-foundry / log_foundry in 0.2.0.

If you are still on 0.1.x, there is no compatibility shim: migrating is a find-and-replace on log_forge → log_foundry; no module moved and no public API changed. A handful of emitted defaults carry the name and shift with it: LoggingSink's default logger (logging.getLogger("log_foundry")), SyslogSink(app_name=…), SplunkHECSink(source=…), Datadog's ddsource, and Sentry's client tag. Override them explicitly if a downstream query or dashboard pins the old string.

import log_foundry

print(log_foundry.__version__)     # the installed version

To work on the library itself, install from a clone:

# the version is derived from Git tags, so clone with history (not --depth 1)
poetry self add "poetry-dynamic-versioning[plugin]"   # one-time, resolves the version locally
poetry install --with dev                             # or: pip install -e .
Optional extras

The core is dependency-free. Each sink built on a third-party client lives behind its own extra (the client is imported lazily, only when you construct that sink, and a missing one is refused with a ModuleNotFoundError naming the extra to install). All other sinks — stdout, file, SQLite, the stdlib-logging bridge, and every HTTP/socket platform sink (Elasticsearch, Loki, Logstash, Syslog, Datadog, Splunk, New Relic, Honeycomb) — need no extra.

Extra Installs Enables
aws boto3 SQSSink, SNSSink, KinesisSink, FirehoseSink
sentry sentry-sdk SentrySink via the SDK (a raw-HTTP fallback works without it)
kafka confluent-kafka KafkaSink
redis redis RedisStreamsSink, RedisListSink
amqp pika RabbitMQSink
nats nats-py NATSSink
gcp-pubsub google-cloud-pubsub GooglePubSubSink
azure-eventhubs azure-eventhub AzureEventHubsSink
mongo pymongo MongoDBSink
postgres psycopg[binary] PostgresSink
clickhouse clickhouse-connect ClickHouseSink

Quickstart

import log_foundry as lf

# Call once at startup. These values are stamped onto every event.
lf.configure(service="billing-api", version="1.4.2", env="prod")

@lf.trace
def charge(order_id: str) -> int:
    return compute_tax(order_id)

@lf.trace(name="tax.compute", defaults={"component": "tax"})
def compute_tax(order_id: str) -> int:
    return 42

charge("ord_123")

With no sink configured, events are written as JSON lines to stdout. The call above emits four events — a span.start / span.end pair per function — all sharing one trace_id, with the child span pointing at its parent via parent_span_id:

{"timestamp": "2026-07-10T00:57:10.411Z", "level": "INFO", "message": "span.start", "trace_id": "8ab2add1480f8f6a52fe97cd23ae6f36", "span_id": "6aeb63c0eba85bf4", "parent_span_id": "b02197e75f40eb81", "log_id": "754adb40e10c445f9ec9e23a2f3dcbf2", "function": "tax.compute", "service": "billing-api", "version": "1.4.2", "env": "prod", "fields": {"component": "tax"}}
{"timestamp": "2026-07-10T00:57:10.411Z", "level": "INFO", "message": "span.end", "trace_id": "8ab2add1480f8f6a52fe97cd23ae6f36", "span_id": "6aeb63c0eba85bf4", "parent_span_id": "b02197e75f40eb81", "log_id": "3af73c51540848afbeaba9fdf7a9dce8", "function": "tax.compute", "service": "billing-api", "version": "1.4.2", "env": "prod", "fields": {"component": "tax"}, "duration_ms": 0.0233328901231289, "status": "ok"}
{"timestamp": "2026-07-10T00:57:10.411Z", "level": "INFO", "message": "span.start", "trace_id": "8ab2add1480f8f6a52fe97cd23ae6f36", "span_id": "b02197e75f40eb81", "parent_span_id": null, "log_id": "e789f7e5268b46d8b779c9cbcdde8656", "function": "charge", "service": "billing-api", "version": "1.4.2", "env": "prod", "fields": {}}
{"timestamp": "2026-07-10T00:57:10.411Z", "level": "INFO", "message": "span.end", "trace_id": "8ab2add1480f8f6a52fe97cd23ae6f36", "span_id": "b02197e75f40eb81", "parent_span_id": null, "log_id": "8f3dbfcfcf4a45f688c738eefef882b0", "function": "charge", "service": "billing-api", "version": "1.4.2", "env": "prod", "fields": {}, "duration_ms": 0.342666869983077, "status": "ok"}

Note on ordering: the child span (tax.compute) finishes first, so its events flush before the parent's. Correlate by trace_id / parent_span_id, not by line order.

How it works

log-foundry pipeline: a traced call opens a span, gathers events, then closes and hands off to a background worker that batches events and ships them to a sink. Steps 1–4 run on your thread; the worker and sink run on a background thread. Support modules — config, ids, model, context, console — assist every step.

A traced call travels through a small pipeline. The first four steps run on your own thread and are deliberately fast; the last two run on a background thread so your code never waits on the destination. That is the traced path. A level call with no open span takes the synchronous route instead, described under Flushing and shutdown — and "open" is the operative word: a task that outlives its span still sees that span, but it has closed, so the call takes the synchronous route too.

  1. You call the code — a @trace function, or one of the debug/info/… emitters.
  2. A span opens — a record of this one call. It inherits the current trace and parent (see below), or starts a fresh trace if nothing is active.
  3. Events gather on the span — an automatic span.start, then any events you emit, held in memory rather than written line by line. While the span is open, the background worker takes the events you have emitted about once a flush interval (a second by default) and ships them, so a long-running call's logs do not wait for it to return. span.start stays on the span.
  4. The span closes and hands off — on return or exception, a span.end event is added (with duration and status), and what the span still holds, span.start, span.end and any events logged since the worker last took from it, is handed to the background worker. This hand-off is instant and never blocks; on an exception the original error is re-raised unchanged.
  5. The worker batches — the worker groups bundles and flushes them together (see below).
  6. The sink ships them out — StdoutSink by default, or SQSSink in production.

Supporting this path are a handful of single-concept modules: config (the process-wide service/version/env and the sink), ids (trace/span/log ids), model (assembles the one JSON shape), context (holds the current span and baggage), and console (the optional instant echo= line).

Building the trace tree

Nested calls form a tree through a stack of open spans kept in a contextvars context — the top of the stack is the "current" span. When a traced function starts, it reads the current span: if one exists, the new span copies its trace_id and records its span_id as parent_span_id; if the stack is empty, the new span starts a fresh trace with no parent. The new span is then pushed, so anything it calls sees it as the parent. On exit the span is popped by restoring the stack to its exact prior state (via a token, not a blind pop), which stays correct even when code branches into concurrent tasks. Because the stack lives in a context variable, every asyncio task gets its own isolated copy — so asyncio.gather children share their parent's trace, and baggage set in one task never leaks into a sibling. A new thread gets a fresh context rather than a copy, so nothing follows it there unless the caller copies one (as asyncio.to_thread does).

When the worker flushes

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases log-foundry

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Cry2Wolf: How to Tell a Real Bug from a Nothingburger
AI & VibeSec

Cry2Wolf: Not Every Branded Bug Deserves a Fire Drill

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

Critical Apache HTTP Server Flaw Exposes Web Servers to RCE (1)
CVE

CVE-2026-119618: Critical Apache HTTP Server Flaw Exposes Web Servers to Remote Code Execution

Frame 2085668439 (1)
Group 1261154229