---
title: formatters
sidebarTitle: formatters
---

# `prefect.logging.formatters`

## Functions

### `format_exception_info` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/logging/formatters.py#L19" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
format_exception_info(exc_info: ExceptionInfoType) -> dict[str, Any]
```

## Classes

### `JsonFormatter` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/logging/formatters.py#L37" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>


Formats log records as a JSON string.

The format may be specified as "pretty" to format the JSON with indents and
newlines.


**Methods:**

#### `format` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/logging/formatters.py#L58" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
format(self, record: logging.LogRecord) -> str
```

### `PrefectFormatter` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/logging/formatters.py#L76" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

**Methods:**

#### `formatMessage` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/logging/formatters.py#L125" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
formatMessage(self, record: logging.LogRecord) -> str
```
