log-foundry 0.10.2.dev8__tar.gz → 0.10.2.dev9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/PKG-INFO +1 -1
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/pyproject.toml +1 -1
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/api.py +31 -12
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/LICENSE +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/README.md +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/__init__.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/_diag.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/config.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/console.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/context.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/decorator.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/ids.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/model.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/py.typed +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sanitize.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/__init__.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/_batch.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/_chunk.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/_socket.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/_time.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/base.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/callback.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/clickhouse.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/datadog.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/elasticsearch.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/eventhubs.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/file.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/filtering.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/firehose.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/honeycomb.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/http.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/kafka.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/kinesis.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/logging_sink.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/logstash.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/loki.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/mongodb.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/multi.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/nats.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/newrelic.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/postgres.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/pubsub.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/rabbitmq.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/redis.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/sentry.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/sns.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/splunk.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/sqlite.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/sqs.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/stdout.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/syslog.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/transform.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/sinks/util.py +0 -0
- {log_foundry-0.10.2.dev8 → log_foundry-0.10.2.dev9}/src/log_foundry/worker.py +0 -0
|
@@ -12,7 +12,7 @@ the sink via the normal path.
|
|
|
12
12
|
|
|
13
13
|
from __future__ import annotations
|
|
14
14
|
|
|
15
|
-
from log_foundry import context
|
|
15
|
+
from log_foundry import _diag, context
|
|
16
16
|
from log_foundry.config import _ensure_sink
|
|
17
17
|
from log_foundry.console import ConsoleWriter
|
|
18
18
|
from log_foundry.context import set_baggage
|
|
@@ -40,9 +40,16 @@ def _log(level: str, message: str, echo: bool, fields: dict[str, object]) -> Non
|
|
|
40
40
|
With no active span (orphan) it becomes a standalone one-event span — fresh ``trace_id``,
|
|
41
41
|
``parent_span_id=None`` — flushed directly so nothing is dropped (FR-004). ``echo`` writes
|
|
42
42
|
the same event as a human-readable console line, additively.
|
|
43
|
+
|
|
44
|
+
The orphan branch is the one that reaches the sink **on the caller's own thread**, with no
|
|
45
|
+
worker between them to absorb a failure, so it is guarded end to end (SPEC-025 FR-003): a
|
|
46
|
+
bare ``log_foundry.info(...)`` must not hand the application a ``ConnectionError`` from a
|
|
47
|
+
destination the application never chose to talk to. The in-span branch is deliberately left
|
|
48
|
+
untouched — it only appends to a list, and FR-003 requires no behaviour change there.
|
|
43
49
|
"""
|
|
44
50
|
baggage = context.get_baggage()
|
|
45
51
|
span = context.current_span()
|
|
52
|
+
event: dict[str, object] | None = None
|
|
46
53
|
if span is not None:
|
|
47
54
|
event = build_event(span, level, message, fields=fields, baggage=baggage)
|
|
48
55
|
span.events.append(event)
|
|
@@ -51,17 +58,29 @@ def _log(level: str, message: str, echo: bool, fields: dict[str, object]) -> Non
|
|
|
51
58
|
# log is recorded, not silently dropped. Resolve the sink via _ensure_sink (as the
|
|
52
59
|
# decorator does) so a zero-config orphan log falls back to StdoutSink instead of
|
|
53
60
|
# crashing. SPEC-004's worker will later own this direct handoff.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
try:
|
|
62
|
+
orphan = Span(
|
|
63
|
+
trace_id=new_trace_id(),
|
|
64
|
+
span_id=new_span_id(),
|
|
65
|
+
parent_span_id=None,
|
|
66
|
+
name=message,
|
|
67
|
+
start_ts=0.0,
|
|
68
|
+
)
|
|
69
|
+
event = build_event(orphan, level, message, fields=fields, baggage=baggage)
|
|
70
|
+
_ensure_sink().emit([event])
|
|
71
|
+
except Exception as exc:
|
|
72
|
+
# The whole branch, not just `emit`: `_ensure_sink` constructs the sink on first
|
|
73
|
+
# use, so a sink that fails to *build* raises here too — and that is the shape the
|
|
74
|
+
# spec's own motivating case takes.
|
|
75
|
+
_diag.absorbed("emitting an orphan log", exc, "the event was lost")
|
|
76
|
+
if echo and event is not None:
|
|
77
|
+
try:
|
|
78
|
+
_console.write(event)
|
|
79
|
+
except Exception as exc:
|
|
80
|
+
# An echo is a diagnostic convenience and must not outrank the caller: the stream
|
|
81
|
+
# may be closed, redirected, or gone at interpreter shutdown. It runs *after* the
|
|
82
|
+
# emit, so a broken console never costs the event itself.
|
|
83
|
+
_diag.absorbed("echoing to the console", exc)
|
|
65
84
|
|
|
66
85
|
|
|
67
86
|
def debug(message: str, *, echo: bool = False, **fields: object) -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|