diff --git a/docs/platforms/godot/configuration/options.mdx b/docs/platforms/godot/configuration/options.mdx index 95d057c34afa8..1184947ce9c18 100644 --- a/docs/platforms/godot/configuration/options.mdx +++ b/docs/platforms/godot/configuration/options.mdx @@ -163,11 +163,24 @@ This option is turned on by default. -## Error Logger Options +## Logging Options + + + +If `true`, enables Sentry structured logs functionality, allowing you to use dedicated logging APIs through +`SentrySDK.logger`, and Godot's built-in log messages are automatically captured and sent to Sentry Logs. +Use `logger_enabled` and other `logger_*` options to control how Godot's error messages and log output +(including `print()` statements) are captured and processed by Sentry. + +This option is turned on by default. + + + +## Godot Logger Options -If `true`, the SDK will capture logged errors as events and/or breadcrumbs, as defined by `logger_event_mask` and `logger_breadcrumb_mask` options. Crashes are always captured. +If `true`, the SDK will capture logged errors as events, logs and/or breadcrumbs, as defined by `logger_event_mask` and `logger_breadcrumb_mask` options. Crashes are always captured. See also `enable_logs` option. This option is turned on by default. @@ -255,7 +268,7 @@ These options can be used to hook the SDK in various ways to customize the repor The callbacks you set as hooks will be called on the thread where the event happened. So you can only use thread-safe APIs and only use Godot-specific APIs after you've checked that you're on the main thread. - + If assigned, this callback runs before an event is sent to Sentry. You can only set it [programmatically](#programmatic-configuration). It takes `SentryEvent` as a parameter and returns either the same event object, with or without modifications, or `null` to skip reporting the event. This can be used, for instance, for stripping PII before sending. @@ -274,7 +287,7 @@ func _before_send(event: SentryEvent) -> SentryEvent: - + If assigned, this callback runs before a screenshot is captured. You can only set it [programmatically](#programmatic-configuration). It takes `SentryEvent` as a parameter and returns `false` to skip capturing the screenshot, or `true` to capture the screenshot. @@ -286,3 +299,22 @@ func _before_capture_screenshot(event: SentryEvent) -> bool: ``` + + + +If assigned, this callback will be called before sending a log message to Sentry. +It can be used to modify the log message or prevent it from being sent. + +```GDScript +func _before_send_log(log_entry: SentryLog) -> SentryLog: + # Filter junk. + if log_entry.body == "Junk message": + return null + # Remove sensitive information from log messages. + log_entry.body = log_entry.body.replace("Bruno", "REDACTED") + # Add custom attributes. + log_entry.set_attribute("current_scene", current_scene.name) + return log_entry +``` + + diff --git a/platform-includes/getting-started-primer/godot.mdx b/platform-includes/getting-started-primer/godot.mdx index e5332a7ce0192..68574fae848c2 100644 --- a/platform-includes/getting-started-primer/godot.mdx +++ b/platform-includes/getting-started-primer/godot.mdx @@ -10,7 +10,7 @@ Our SDK for Godot Engine builds on top of existing Sentry SDKs, extending them w - Automatically capture Godot runtime errors, such as script and shader errors - GDScript stack traces with optional [local and member variable](/platforms/godot/configuration/options/#logger_include_variables) information - Include surrounding script source code with events when available at runtime -- Automatic breadcrumbs for console output, such as `print()` statements +- [Structured Logs](/platforms/godot/logs/) that automatically capture console output like `print()` statements and connect to your traces with searchable attributes - [Enrich events](/platforms/godot/enriching-events/) with tags, breadcrumbs, contexts, and attachments - Information about user configuration like GPU, CPU, platform and such - [Filter and customize events](/platforms/godot/data-management/sensitive-data/#scrubbing-data) in `before_send` callback (in GDScript) diff --git a/platform-includes/logs/options/godot.mdx b/platform-includes/logs/options/godot.mdx index 273f9c9edfd23..90553463ea8b4 100644 --- a/platform-includes/logs/options/godot.mdx +++ b/platform-includes/logs/options/godot.mdx @@ -4,8 +4,8 @@ To filter logs, or update them before they are sent to Sentry, you can use the ` ```GDScript SentrySDK.init(func(options: SentryOptions) -> void: - options.experimental.enable_logs = true - options.experimental.before_send_log = _before_send_log + options.enable_logs = true + options.before_send_log = _before_send_log ) func _before_send_log(log_entry: SentryLog) -> SentryLog: diff --git a/platform-includes/logs/requirements/godot.mdx b/platform-includes/logs/requirements/godot.mdx index 7537475250dfc..4c8cbbf440938 100644 --- a/platform-includes/logs/requirements/godot.mdx +++ b/platform-includes/logs/requirements/godot.mdx @@ -1 +1,2 @@ Logs for Godot Engine are supported in Sentry Godot SDK version `1.1.0` and above. +Starting with version `1.2.0`, the feature is generally available and enabled by default. diff --git a/platform-includes/logs/setup/godot.mdx b/platform-includes/logs/setup/godot.mdx index 1a9734f05d4bc..d3a555bc66f75 100644 --- a/platform-includes/logs/setup/godot.mdx +++ b/platform-includes/logs/setup/godot.mdx @@ -2,15 +2,14 @@ To enable logging in your Godot project, you need to configure the Sentry SDK wi ### Project Settings Configuration -1. Open **Project Settings** in Godot, and navigate to **Sentry > Experimental**. -2. Turn on the **Enable Logs** option. +Structured logs are enabled by default. If you want to modify this setting, navigate to **Project Settings** in Godot, then go to **Sentry > Options** and adjust the **Enable Logs** option as needed. ### Programmatic Configuration -Alternatively, you can enable logs programmatically when initializing the SDK: +Structured logs are enabled by default. If needed, you can disable logs programmatically when initializing the SDK: ```GDScript SentrySDK.init(func(options: SentryOptions) -> void: - options.experimental.enable_logs = true + options.enable_logs = false ) ```