diff --git a/docs/platforms/python/integrations/logging/index.mdx b/docs/platforms/python/integrations/logging/index.mdx index b817408e435b97..9683270ad88101 100644 --- a/docs/platforms/python/integrations/logging/index.mdx +++ b/docs/platforms/python/integrations/logging/index.mdx @@ -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 ), ], ) @@ -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}, + ) + ``` + 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`. diff --git a/docs/platforms/python/integrations/loguru/index.mdx b/docs/platforms/python/integrations/loguru/index.mdx index 9bd471101724ad..8301995f88219e 100644 --- a/docs/platforms/python/integrations/loguru/index.mdx +++ b/docs/platforms/python/integrations/loguru/index.mdx @@ -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 + ) ], ) ``` @@ -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+