Skip to content

feat(log): add view command to display log entry details#212

Merged
betegon merged 10 commits intomainfrom
feat/log-view-command
Feb 6, 2026
Merged

feat(log): add view command to display log entry details#212
betegon merged 10 commits intomainfrom
feat/log-view-command

Conversation

@betegon
Copy link
Member

@betegon betegon commented Feb 6, 2026

Summary

Adds sentry log view <log-id> command to display detailed information about a single Sentry log entry. Complements the existing sentry log list command.

Features

  • Auto-detection: Works with DSN or config defaults when org/project is omitted
  • Flexible targeting: sentry log view <org>/<project> <log-id> or sentry log view <project> <log-id>
  • JSON output: --json flag for machine-readable output
  • Browser: --web flag opens the log in Sentry's Logs explorer
  • Trace integration: Shows clickable trace URL when trace ID is present

Output

Human-readable output includes:

  • Core info: ID, timestamp, severity, message
  • Context: project, environment, release
  • SDK: name, version
  • Trace: trace ID, span ID, link to trace view
  • Source location: function, file, line (when available)
  • OpenTelemetry data (when available)

Test Plan

# Get a log ID from list
sentry log list <org>/<project> --limit 1 --json

# View the log
sentry log view <log-id>
sentry log view <org>/<project> <log-id>
sentry log view <log-id> --json
sentry log view <log-id> --web

Adds 'sentry log view <log-id>' to display detailed information about a
single log entry. Supports:

- Auto-detect org/project from DSN or config
- Explicit target: sentry log view <org>/<project> <log-id>
- Project search: sentry log view <project> <log-id>
- JSON output with --json flag
- Open in browser with --web flag
- Trace link when trace ID is present

Output includes:
- Core: ID, timestamp, severity, message
- Context: project, environment, release
- SDK: name, version
- Trace: trace ID, span ID, clickable link
- Source location: function, file, line (when available)
- OpenTelemetry data (when available)
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (cli) Add plural command aliases for list commands by betegon in #209
  • (log) Add view command to display log entry details by betegon in #212

Bug Fixes 🐛

Upgrade

  • Handle EPERM in isProcessRunning for cross-user locks by BYK in #211
  • Replace curl pipe with direct binary download by BYK in #208

Documentation 📚

  • Add documentation for log command by betegon in #210

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/pr-preview/pr-212/

Built to branch gh-pages at 2026-02-06 14:49 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Codecov Results 📊

❌ Patch coverage is 69.53%. Project has 2062 uncovered lines.
❌ Project coverage is 76.46%. Comparing base (base) to head (head).

Files with missing lines (41)
File Patch % Lines
human.ts 55.31% ⚠️ 391 Missing
resolve-target.ts 15.28% ⚠️ 366 Missing
api-client.ts 69.27% ⚠️ 197 Missing
oauth.ts 25.10% ⚠️ 194 Missing
upgrade.ts 67.31% ⚠️ 102 Missing
view.ts 47.70% ⚠️ 91 Missing
view.ts 49.07% ⚠️ 82 Missing
migration.ts 47.44% ⚠️ 82 Missing
browser.ts 4.11% ⚠️ 70 Missing
span-tree.ts 5.00% ⚠️ 57 Missing
telemetry.ts 77.51% ⚠️ 56 Missing
api.ts 89.80% ⚠️ 47 Missing
seer.ts 75.54% ⚠️ 45 Missing
schema.ts 89.56% ⚠️ 40 Missing
seer.ts 79.87% ⚠️ 30 Missing
preload.ts 53.23% ⚠️ 29 Missing
utils.ts 88.94% ⚠️ 25 Missing
detector.ts 90.10% ⚠️ 20 Missing
output.ts 15.00% ⚠️ 17 Missing
code-scanner.ts 95.00% ⚠️ 16 Missing
arg-parsing.ts 90.00% ⚠️ 12 Missing
dsn-cache.ts 94.62% ⚠️ 12 Missing
fix.ts 83.61% ⚠️ 10 Missing
qrcode.ts 33.33% ⚠️ 10 Missing
fs-utils.ts 57.14% ⚠️ 9 Missing
project-root.ts 97.73% ⚠️ 7 Missing
version-check.ts 91.76% ⚠️ 7 Missing
feedback.ts 84.21% ⚠️ 6 Missing
auth.ts 95.52% ⚠️ 6 Missing
upgrade.ts 93.83% ⚠️ 5 Missing
resolver.ts 94.57% ⚠️ 5 Missing
index.ts 95.96% ⚠️ 4 Missing
project-aliases.ts 97.40% ⚠️ 2 Missing
project-root-cache.ts 96.92% ⚠️ 2 Missing
json.ts 33.33% ⚠️ 2 Missing
alias.ts 99.42% ⚠️ 1 Missing
env-file.ts 99.19% ⚠️ 1 Missing
parser.ts 98.63% ⚠️ 1 Missing
colors.ts 97.96% ⚠️ 1 Missing
helpers.ts 94.74% ⚠️ 1 Missing
helpers.ts 94.74% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    76.73%    76.46%    -0.27%
==========================================
  Files           65        66        +1
  Lines         8419      8758      +339
  Branches         0         0         —
==========================================
+ Hits          6460      6696      +236
- Misses        1959      2062      +103
- Partials         0         0         —

Generated by Codecov Action

Unit tests:
- test/commands/log/view.test.ts: parsePositionalArgs, resolveFromProjectSearch

E2E tests:
- test/e2e/log.test.ts: auth, context resolution, JSON output, error handling

Formatter tests:
- test/lib/formatters/log.test.ts: formatLogDetails output sections

Supporting changes:
- Export resolveFromProjectSearch for testing
- Add test/fixtures/log-detail.json fixture
- Update test/mocks/routes.ts to handle single log queries
Property tests for:
- buildLogsUrl and buildTraceUrl URL builders
- parsePositionalArgs argument parsing
- formatLogDetails output formatting

Tests verify invariants like:
- URL validity, determinism, expected patterns
- Correct field assignment regardless of input
- Conditional sections appear only when data present
@betegon betegon marked this pull request as ready for review February 6, 2026 14:58
@betegon betegon force-pushed the feat/log-view-command branch from 130dae7 to b9b9fa0 Compare February 6, 2026 15:03
- Include org placeholder in multi-project error example message
- Fix SDK formatting when only version exists (no name)
- Use dynamic header length for separator width instead of hardcoded value
- Add projectSlug parameter to getLog() API function for proper filtering
- Use project:slug filter in query to ensure logs match the resolved project
- Change 'log not found' error from ContextError to ValidationError
  (the log ID was provided, it just doesn't exist - not a missing context issue)
- Update mock server to parse project filter from query string
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@betegon betegon merged commit 8c98a84 into main Feb 6, 2026
24 checks passed
@betegon betegon deleted the feat/log-view-command branch February 6, 2026 17:13
@betegon betegon mentioned this pull request Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant