> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Format Forensics For Log • AI Agent SDK

> format_forensics_for_log: Render a forensic snapshot dict as a single, stable log line.

# format\_forensics\_for\_log

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**protocols**](../modules/protocols) module.

Render a forensic snapshot dict as a single, stable log line.

Pure and side-effect free so it is provable in isolation and safe to call
from a signal handler. Unknown/missing fields are simply omitted; the
output is a compact `key=value` sequence prefixed with a stable marker so
operators (and log scrapers) can grep `gateway-forensics` reliably.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def format_forensics_for_log(ctx: Optional[Dict[str, Any]]) -> str
```

## Parameters

<ParamField query="ctx" type="Optional" required={true}>
  The dict returned by :meth:`ShutdownForensicsProtocol.snapshot`, or `None`.
</ParamField>

### Returns

<ResponseField name="Returns" type="str">
  A single-line, human-readable summary. Never raises.
</ResponseField>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L4152">
  `praisonaiagents/gateway/protocols.py` at line 4152
</Card>
