Skip to content

Commit db98333

Browse files
committed
fix(logs): Remove duplicate inline best practices from JS logs page
The merge from master brought in inline best practices from #16195 alongside the PlatformContent include from this PR. Keep only the include to stay consistent with all other platform logs pages. Made-with: Cursor
1 parent 7396ff9 commit db98333

File tree

1 file changed

+0
-76
lines changed
  • docs/platforms/javascript/common/logs

1 file changed

+0
-76
lines changed

docs/platforms/javascript/common/logs/index.mdx

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -212,82 +212,6 @@ Everything in Sentry is linked by trace. When you're viewing a log, you can jump
212212
213213
## Best Practices
214214
215-
<SplitLayout>
216-
217-
<SplitSection>
218-
<SplitSectionText>
219-
220-
### Wide Events Over Scattered Logs
221-
222-
Instead of many small logs that are hard to correlate, emit one comprehensive log per operation with all relevant context.
223-
224-
This makes debugging dramatically faster — one query returns everything about a specific order, user, or request.
225-
226-
</SplitSectionText>
227-
<SplitSectionCode>
228-
229-
```javascript
230-
// ❌ Scattered thin logs
231-
Sentry.logger.info("Starting checkout");
232-
Sentry.logger.info("Validating cart");
233-
Sentry.logger.info("Processing payment");
234-
Sentry.logger.info("Checkout complete");
235-
236-
// ✅ One wide event with full context
237-
Sentry.logger.info("Checkout completed", {
238-
orderId: order.id,
239-
userId: user.id,
240-
cartValue: cart.total,
241-
itemCount: cart.items.length,
242-
paymentMethod: "stripe",
243-
duration: Date.now() - startTime,
244-
});
245-
```
246-
247-
</SplitSectionCode>
248-
</SplitSection>
249-
250-
<SplitSection>
251-
<SplitSectionText>
252-
253-
### Include Business Context
254-
255-
Add attributes that help you prioritize and debug:
256-
257-
- **User context** — tier, account age, lifetime value
258-
- **Transaction data** — order value, item count
259-
- **Feature state** — active feature flags
260-
- **Request metadata** — endpoint, method, duration
261-
262-
This lets you filter logs by high-value customers or specific features.
263-
264-
</SplitSectionText>
265-
<SplitSectionCode>
266-
267-
```javascript
268-
Sentry.logger.info("API request completed", {
269-
// User context
270-
userId: user.id,
271-
userTier: user.plan, // "free" | "pro" | "enterprise"
272-
273-
// Request data
274-
endpoint: "/api/orders",
275-
method: "POST",
276-
duration: 234,
277-
278-
// Business context
279-
orderValue: 149.99,
280-
featureFlags: ["new-checkout", "discount-v2"],
281-
});
282-
```
283-
284-
</SplitSectionCode>
285-
</SplitSection>
286-
287-
</SplitLayout>
288-
289-
## Best Practices
290-
291215
<PlatformContent includePath="logs/best-practices" />
292216
293217
## Default Attributes

0 commit comments

Comments
 (0)