orchestrata_ultimate.kernel.audit._common
Reference › orchestrata_ultimate › kernel › audit › _common
Shared primitives for the audit package: the module logger, the flags that record whether optional backends are importable, and a small UTC time helper _utc_now. The package initialiser, logger, queue and writers import it so that they share one definition instead of repeating it.
At a glance
| Source | src/orchestrata_ultimate/kernel/audit/_common.py |
| Lines of code | 30 |
| Classes | 0 |
| Functions | 1 |
| Imports (internal) | orchestrata_ultimate.core.base.traces |
| Imported by | orchestrata_ultimate.kernel.audit, orchestrata_ultimate.kernel.audit.logger, orchestrata_ultimate.kernel.audit.queue, orchestrata_ultimate.kernel.audit.writers |
| Tests that import it | tests/kernel/audit/test_common.py |
Class diagram
No classes; see Functions.
Dependency diagram
API
Functions
| Function | Signature | Summary |
|---|---|---|
_utc_now traces |
_utc_now() -> datetime |
Get current UTC time with timezone info. |
Source
# mypy: ignore-errors
"""Shared audit primitives: logger, optional-backend flags, time helper."""
import logging
from datetime import UTC, datetime
from orchestrata_ultimate.core.base.traces import traces
try:
import redis.asyncio as redis # noqa: F401 (re-exported for queue.py)
REDIS_AVAILABLE = True
except ImportError: # pragma: no cover - redis is a hard dependency in prod/test
REDIS_AVAILABLE = False
try:
import neo4j # noqa: F401 (presence check only — writers.py uses core.graph)
GRAPH_DRIVER_AVAILABLE = True
except ImportError: # pragma: no cover - neo4j is a hard dependency in prod/test
GRAPH_DRIVER_AVAILABLE = False
# Module-level logger
_logger = logging.getLogger(__name__)
@traces(spec="001", story="US-008", reqs=["REQ-001-US-008-008"])
def _utc_now() -> datetime:
"""Get current UTC time with timezone info."""
return datetime.now(UTC)