Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions docs/platforms/python/integrations/logging/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ sentry_sdk.init(
# ...
integrations=[
LoggingIntegration(
level=logging.INFO, # Capture info and above as breadcrumbs
event_level=logging.INFO # Send records as events
level=logging.INFO, # Capture INFO and above as breadcrumbs
event_level=logging.ERROR, # Send ERROR records as events
sentry_logs_level=logging.INFO, # Capture INFO and above as logs
),
],
)
Expand All @@ -85,6 +86,15 @@ You can pass the following keyword arguments to `LoggingIntegration()`:

- `event_level` (default `ERROR`): The Sentry Python SDK will report log records with a level higher than or equal to `event_level` as events as long as the logger itself is set to output records of those log levels (see note below). If a value of `None` occurs, the SDK won't send log records as events.

- `sentry_logs_level` (default `INFO`): The Sentry Python SDK will capture records with a level higher than or equal to `sentry_logs_level` as logs as long as the `enable_logs` experimental option is `True`:

```python
sentry_sdk.init(
# ...
_experiments={"enable_logs": True},
)
```

<Alert title="Note">

The Sentry Python SDK will honor the configured level of each logger (set with `logger.setLevel(level)` or `logging.basicConfig(level=level)`). That means that you will not see any `INFO` or `DEBUG` events from a logger with the level set to `WARNING`, regardless of how you configure the integration. If not set explicitly, the logging level defaults to `WARNING`.
Expand Down
27 changes: 21 additions & 6 deletions docs/platforms/python/integrations/loguru/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,14 @@ from loguru import logger
from sentry_sdk.integrations.loguru import LoguruIntegration
from sentry_sdk.integrations.loguru import LoggingLevels

sentry_loguru = LoguruIntegration(
level=LoggingLevels.INFO.value, # Capture info and above as breadcrumbs
event_level=LoggingLevels.ERROR.value # Send errors as events
)

sentry_sdk.init(
# ...
integrations=[
sentry_loguru,
LoguruIntegration(
level=LoggingLevels.INFO.value, # Capture INFO and above as breadcrumbs
event_level=LoggingLevels.ERROR.value, # Send ERROR logs as events
sentry_logs_level=LoggingLevels.INFO.value, # Capture INFO and above as logs
)
],
)
```
Expand All @@ -133,6 +132,22 @@ sentry_sdk.init(

Default: `ERROR`

- `sentry_logs_level`

The Sentry Python SDK will capture log records with a level higher than or equal to `sentry_logs_level` as logs. If set to `None`, the SDK won't send records as logs.

To capture Loguru log records as Sentry logs, you must enable the experimental `enable_logs` option when initializing the SDK (regardless of the `sentry_logs_level` setting).

```python
sentry_sdk.init(
# ...
_experiments={"enable_logs": True},
)
```

Default: `INFO`


## Supported Versions

- Loguru: 0.5+
Expand Down