Skip to content
Open
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
4 changes: 4 additions & 0 deletions docs/platforms/android/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ With Sentry Structured Logs, you can send text-based log information from your a

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
Expand Down
4 changes: 4 additions & 0 deletions docs/platforms/apple/common/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ With Sentry Structured Logs, you can send text-based log information from your a

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
Expand Down
4 changes: 4 additions & 0 deletions docs/platforms/dart/common/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ With Sentry Structured Logs, you can send text-based log information from your a

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
Expand Down
4 changes: 4 additions & 0 deletions docs/platforms/dart/guides/flutter/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ With Sentry Structured Logs, you can send text-based log information from your a

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
Expand Down
4 changes: 4 additions & 0 deletions docs/platforms/dotnet/common/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ With Sentry Structured Logs, you can send text-based log information from your a

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
4 changes: 4 additions & 0 deletions docs/platforms/go/common/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ If the `Debug` init option is set to true, calls to the `sentry.Logger` will als

<Include name="logs/go-ctx-usage-alert.mdx" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
4 changes: 4 additions & 0 deletions docs/platforms/godot/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ With Sentry Structured Logs, you can send text-based log information from your G

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
Expand Down
4 changes: 4 additions & 0 deletions docs/platforms/java/common/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ With Sentry Structured Logs, you can send text-based log information from your a

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
4 changes: 4 additions & 0 deletions docs/platforms/javascript/common/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ With Sentry Structured Logs, you can send text-based log information from your a

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
105 changes: 1 addition & 104 deletions docs/platforms/javascript/guides/nextjs/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -160,110 +160,7 @@ Sentry.withScope((scope) => {

## Best Practices

<SplitLayout>
<SplitSection>
<SplitSectionText>

### Wide Events Over Scattered Logs

Instead of many thin logs that are hard to correlate, emit one comprehensive log per operation with all relevant context.

This makes debugging dramatically faster — one query returns everything about a specific order, user, or request.

</SplitSectionText>
<SplitSectionCode>

```typescript
// ❌ Scattered thin logs
Sentry.logger.info("Starting checkout");
Sentry.logger.info("Validating cart");
Sentry.logger.info("Processing payment");
Sentry.logger.info("Checkout complete");

// ✅ One wide event with full context
Sentry.logger.info("Checkout completed", {
orderId: order.id,
userId: user.id,
userTier: user.subscription,
cartValue: cart.total,
itemCount: cart.items.length,
paymentMethod: "stripe",
duration: Date.now() - startTime,
});
```

</SplitSectionCode>
</SplitSection>

<SplitSection>
<SplitSectionText>

### Include Business Context

Add attributes that help you prioritize and debug:

- **User context** — tier, account age, lifetime value
- **Transaction data** — order value, item count
- **Feature state** — active feature flags
- **Request metadata** — endpoint, method, duration

This lets you filter logs by high-value customers or specific features.

</SplitSectionText>
<SplitSectionCode>

```typescript
Sentry.logger.info("API request completed", {
// User context
userId: user.id,
userTier: user.plan, // "free" | "pro" | "enterprise"
accountAgeDays: user.ageDays,

// Request data
endpoint: "/api/orders",
method: "POST",
duration: 234,

// Business context
orderValue: 149.99,
featureFlags: ["new-checkout", "discount-v2"],
});
```

</SplitSectionCode>
</SplitSection>

<SplitSection>
<SplitSectionText>

### Consistent Attribute Naming

Pick a naming convention and stick with it across your codebase. Inconsistent names make queries impossible.

**Recommended:** Use `snake_case` for custom attributes to match common conventions.

</SplitSectionText>
<SplitSectionCode>

```typescript
// ❌ Inconsistent naming
{ user: "123" }
{ userId: "123" }
{ user_id: "123" }
{ UserID: "123" }

// ✅ Consistent snake_case
{
user_id: "123",
order_id: "456",
cart_value: 99.99,
item_count: 3,
}
```

</SplitSectionCode>
</SplitSection>
</SplitLayout>
<PlatformContent includePath="logs/best-practices" />

## Integrations

Expand Down
4 changes: 4 additions & 0 deletions docs/platforms/native/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ With Sentry Structured Logs, you can send text-based log information from your a

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
4 changes: 4 additions & 0 deletions docs/platforms/php/common/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ With Sentry Structured Logs, you can send text-based log information from your a

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
4 changes: 4 additions & 0 deletions docs/platforms/php/guides/laravel/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ With Sentry Structured Logs, you can send text-based log information from your L

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
Expand Down
4 changes: 4 additions & 0 deletions docs/platforms/python/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ With Sentry Structured Logs, you can send text-based log information from your a

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
4 changes: 4 additions & 0 deletions docs/platforms/react-native/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ With Sentry Structured Logs, you can send text-based log information from your a

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
Expand Down
4 changes: 4 additions & 0 deletions docs/platforms/ruby/guides/rails/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ With Sentry Structured Logs, you can send text-based log information from your R

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
Expand Down
4 changes: 4 additions & 0 deletions docs/platforms/ruby/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ With Sentry Structured Logs, you can send text-based log information from your a

<PlatformContent includePath="logs/integrations" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
4 changes: 4 additions & 0 deletions docs/platforms/rust/common/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ let _guard = sentry::init(("___PUBLIC_DSN___", sentry::ClientOptions {
}));
```

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

The Rust SDK automatically sets several default attributes on all log entries to provide context and improve debugging:
Expand Down
4 changes: 4 additions & 0 deletions docs/platforms/unity/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ With Sentry Structured Logs, you can send text-based log information from your U

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
Expand Down
4 changes: 4 additions & 0 deletions docs/platforms/unreal/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ With Sentry Structured Logs, you can send text-based log information from your U

<PlatformContent includePath="logs/options" />

## Best Practices

<PlatformContent includePath="logs/best-practices" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
Expand Down
Loading
Loading