> ## 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

Function

> This function is defined in the [**protocols**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/protocols.md) 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

**ctx** `Optional` *required*

The dict returned by :meth:`ShutdownForensicsProtocol.snapshot`, or `None`.

### Returns

**Returns** `str`

A single-line, human-readable summary. Never raises.

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L5765)
>
> `praisonaiagents/gateway/protocols.py` at line 5765


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.