From e2a3ea32d7b40e22ee11352855d4dd6aa277c373 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 22 Oct 2025 19:19:43 +0200 Subject: [PATCH 1/2] docs(godot): Structured logging --- docs/platforms/godot/logs/index.mdx | 32 +++++++++++++++++++ .../logs/default-attributes/godot.mdx | 9 ++++++ platform-includes/logs/options/godot.mdx | 22 +++++++++++++ platform-includes/logs/requirements/godot.mdx | 1 + platform-includes/logs/setup/godot.mdx | 16 ++++++++++ .../logs/troubleshooting/godot.mdx | 5 +++ platform-includes/logs/usage/godot.mdx | 22 +++++++++++++ 7 files changed, 107 insertions(+) create mode 100644 docs/platforms/godot/logs/index.mdx create mode 100644 platform-includes/logs/default-attributes/godot.mdx create mode 100644 platform-includes/logs/options/godot.mdx create mode 100644 platform-includes/logs/requirements/godot.mdx create mode 100644 platform-includes/logs/setup/godot.mdx create mode 100644 platform-includes/logs/troubleshooting/godot.mdx create mode 100644 platform-includes/logs/usage/godot.mdx diff --git a/docs/platforms/godot/logs/index.mdx b/docs/platforms/godot/logs/index.mdx new file mode 100644 index 00000000000000..85bcaaa43e19ad --- /dev/null +++ b/docs/platforms/godot/logs/index.mdx @@ -0,0 +1,32 @@ +--- +title: Set Up Logs +sidebar_title: Logs +description: "Structured logs allow you to send, view and query logs sent from your applications within Sentry." +sidebar_order: 5600 +--- + +With Sentry Structured Logs, you can send text-based log information from your Godot Engine applications to Sentry. Once in Sentry, these logs can be viewed alongside relevant errors, searched by text-string, or searched using their individual attributes. + +## Requirements + + + +## Setup + + + +## Usage + + + +## Options + + + +## Default Attributes + + + +## Troubleshooting + + diff --git a/platform-includes/logs/default-attributes/godot.mdx b/platform-includes/logs/default-attributes/godot.mdx new file mode 100644 index 00000000000000..79a6d63ad22911 --- /dev/null +++ b/platform-includes/logs/default-attributes/godot.mdx @@ -0,0 +1,9 @@ +The Godot SDK automatically sets several default attributes on all log entries to provide context and improve debugging: + + + + + + + + diff --git a/platform-includes/logs/options/godot.mdx b/platform-includes/logs/options/godot.mdx new file mode 100644 index 00000000000000..273f9c9edfd235 --- /dev/null +++ b/platform-includes/logs/options/godot.mdx @@ -0,0 +1,22 @@ +### before_send_log + +To filter logs, or update them before they are sent to Sentry, you can use the `before_send_log` option. + +```GDScript +SentrySDK.init(func(options: SentryOptions) -> void: + options.experimental.enable_logs = true + options.experimental.before_send_log = _before_send_log +) + +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 +``` + +The `before_send_log` function receives a `SentryLog` object, and should return either the same log object, with or without modifications, or `null` if you want to discard it. diff --git a/platform-includes/logs/requirements/godot.mdx b/platform-includes/logs/requirements/godot.mdx new file mode 100644 index 00000000000000..7537475250dfca --- /dev/null +++ b/platform-includes/logs/requirements/godot.mdx @@ -0,0 +1 @@ +Logs for Godot Engine are supported in Sentry Godot SDK version `1.1.0` and above. diff --git a/platform-includes/logs/setup/godot.mdx b/platform-includes/logs/setup/godot.mdx new file mode 100644 index 00000000000000..1a9734f05d4bc3 --- /dev/null +++ b/platform-includes/logs/setup/godot.mdx @@ -0,0 +1,16 @@ +To enable logging in your Godot project, you need to configure the Sentry SDK with Logs enabled. + +### Project Settings Configuration + +1. Open **Project Settings** in Godot, and navigate to **Sentry > Experimental**. +2. Turn on the **Enable Logs** option. + +### Programmatic Configuration + +Alternatively, you can enable logs programmatically when initializing the SDK: + +```GDScript +SentrySDK.init(func(options: SentryOptions) -> void: + options.experimental.enable_logs = true +) +``` diff --git a/platform-includes/logs/troubleshooting/godot.mdx b/platform-includes/logs/troubleshooting/godot.mdx new file mode 100644 index 00000000000000..8df7e10f22d9b5 --- /dev/null +++ b/platform-includes/logs/troubleshooting/godot.mdx @@ -0,0 +1,5 @@ +### Performance Considerations + +- Logs are sent asynchronously to avoid impacting game performance. +- Consider disabling debug level logs in production to avoid excessive log volume. +- `before_send_log` callback is executed synchronously, so keep processing lightweight. diff --git a/platform-includes/logs/usage/godot.mdx b/platform-includes/logs/usage/godot.mdx new file mode 100644 index 00000000000000..850bc9fb0712c8 --- /dev/null +++ b/platform-includes/logs/usage/godot.mdx @@ -0,0 +1,22 @@ +Once the feature is enabled on the SDK and the SDK is initialized, you can send logs using the `SentrySDK.logger` APIs. + +The `SentrySDK.logger` exposes six methods that you can use to log messages at different log levels: `trace`, `debug`, `info`, `warn`, `error`, and `fatal`. + +```GDScript +SentrySDK.logger.trace("Initialized inventory database") +SentrySDK.logger.debug("Player inventory updated") +SentrySDK.logger.info("Level loaded successfully") +SentrySDK.logger.warn("Item configuration not found") +SentrySDK.logger.error("Failed to save game state") +SentrySDK.logger.fatal("Inventory data corrupted") +``` + + + +Support for log attributes and string interpolation will be added in future releases. + + + +### Godot Logging Integration + +When the feature is enabled, the SDK automatically captures Godot messages, warnings, and errors as logs. You can use `print()`, `push_warning()`, and `push_error()` as usual. These show up as `info`, `warning`, and `error` logs. The SDK also turns runtime errors and warnings into events based on your configuration. From 6c2d5ad9a9d3927c43241b4b319e7415fc45e5f0 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 22 Oct 2025 19:32:20 +0200 Subject: [PATCH 2/2] Remove unrelated attributes --- platform-includes/logs/default-attributes/godot.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/platform-includes/logs/default-attributes/godot.mdx b/platform-includes/logs/default-attributes/godot.mdx index 79a6d63ad22911..ca7dbe18a98e8d 100644 --- a/platform-includes/logs/default-attributes/godot.mdx +++ b/platform-includes/logs/default-attributes/godot.mdx @@ -4,6 +4,4 @@ The Godot SDK automatically sets several default attributes on all log entries t - -