Skip to main content

Overview

Browser Debugger CLI captures all console messages during your session, providing:
  • Smart error and warning prioritization
  • Automatic deduplication
  • Current page vs. history filtering
  • Object expansion for complex data
  • Real-time streaming
Console messages are captured automatically when you start a session.

Basic Usage

Smart Summary (Default)

The default behavior shows a smart summary of the current page:
bdg console
Output:
Console Messages (current page)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ERRORS (2 unique, 5 total occurrences)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

[×3] TypeError: Cannot read property 'map' of undefined
     at app.js:245:12

[×2] Network error: Failed to fetch /api/users
     at api.js:89:7

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WARNINGS (1)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Deprecated API called: getUserInfo()
  at legacy.js:42:5

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
OTHER MESSAGES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

info:  12 messages
debug: 8 messages
By default, only messages from the current page load are shown. Use --history to see all messages from the session.

Filter by Page Load

Current Page Only (Default)

# Smart summary of current page
bdg console
Shows only messages from the most recent navigation. Ideal for debugging the current page state.

All Pages (History)

# Show messages from all page loads
bdg console --history

# Short form
bdg console -H
Includes messages from all navigations during the session. Useful for tracking issues across page transitions.

Filter by Level

Filter messages by their severity level:
# Errors only
bdg console --level error

# Warnings only
bdg console --level warning

# Info messages
bdg console --level info

# Debug messages
bdg console --level debug
bdg console --level error
Shows only error messages (console.error, uncaught exceptions)

Chronological List

View all messages in chronological order:
# List all messages
bdg console --list

# Short form
bdg console -l

# Limit to last 50 messages
bdg console --list --last 50
Output:
[log]   App initialized
[info]  Loading user data...
[warn]  Deprecated API called
[error] TypeError: Cannot read property 'map' of undefined
[debug] Request payload: {userId: 123}
[log]   User data loaded

Limit Message Count

Control how many messages to display:
# Last 50 messages (default: 100)
bdg console --last 50

# All messages
bdg console --last 0

# Last 10 errors
bdg console --level error --last 10

Object Expansion

Console messages with objects are automatically expanded to show nested values:
bdg console
Without expansion:
[log] User: [object Object]
With expansion:
[log] User: {name: "John", email: "[email protected]", roles: ["admin", "user"]}
Objects are expanded up to 3 levels deep. Large objects are truncated with indicator.

Expanded Types

  • Objects: {key: value, nested: {inner: true}}
  • Arrays: [1, 2, 3] instead of Array(3)
  • Dates: Date(2025-03-05T12:00:00.000Z)
  • RegExp: /pattern/flags
  • Errors: Error: message at stack.js:10
  • Maps: Map(2) {key1 => value1, key2 => value2}
  • Sets: Set(3) {value1, value2, value3}

Real-Time Streaming

Stream console messages as they occur:
# Follow mode
bdg console --follow

# Short form
bdg console -f

# Follow errors only
bdg console --follow --level error

# Follow current page
bdg console --follow

# Follow all history
bdg console --follow --history
Press Ctrl+C to stop following and return to shell.

Combine Filters

Filters can be combined for precise results:
# Errors from current page, last 20
bdg console --level error --last 20

# All warnings from history
bdg console --level warning --history

# Last 10 info messages as list
bdg console --level info --list --last 10

# Follow errors from all pages
bdg console --follow --level error --history

Workflow Examples

Debug Application Errors

1

Start Session

bdg https://example.com
2

Check Smart Summary

bdg console
Shows deduplicated errors with occurrence counts and source locations.
3

Get Full Error List

bdg console --level error --list
Chronological list of all errors.
4

Check Network Correlation

# Check if errors correlate with network failures
bdg network list --preset errors

Monitor Page Transitions

# Start with a page
bdg https://example.com/page1

# Navigate to another page (via UI)
# ...

# Check messages from all navigations
bdg console --history

# Compare current vs previous
bdg console              # Current page only
bdg console --history   # All pages

Track Deprecation Warnings

# List all warnings
bdg console --level warning

# Get full list with timestamps
bdg console --level warning --list --json | jq '.data.filtered[] | {timestamp, text}'

# Check if warnings repeat across pages
bdg console --level warning --history

JSON Output

All console commands support --json output:
bdg console --json
bdg console --list --json
bdg console --level error --json

JSON Structure

{
  "version": "0.5.1",
  "success": true,
  "data": {
    "messages": [...],
    "filtered": [...],
    "summary": {
      "total": 45,
      "errors": 2,
      "warnings": 1,
      "info": 32,
      "debug": 10,
      "uniqueErrors": 2,
      "currentPageOnly": true
    }
  }
}

jq Integration

# Extract error messages
bdg console --json | jq -r '.data.filtered[] | select(.level == "error") | .text'

# Count by level
bdg console --json | jq '.data.filtered | group_by(.level) | map({level: .[0].level, count: length})'

# Find errors with stack traces
bdg console --json | jq '.data.filtered[] | select(.level == "error" and .stackTrace)'

# Get unique error messages
bdg console --json | jq -r '.data.filtered[] | select(.level == "error") | .text' | sort -u

# Export to file
bdg console --json > console.json

Understanding Console Types

Browser Debugger CLI maps Chrome console types to levels:
Chrome TypeLevelDescription
errorerrorErrors and exceptions
warnwarningWarnings
loginfoconsole.log()
infoinfoconsole.info()
debugdebugconsole.debug()
tracedebugconsole.trace()
dirinfoconsole.dir()
dirxmlinfoconsole.dirxml()
tableinfoconsole.table()
clearinfoconsole.clear()
countinfoconsole.count()
timeinfoconsole.time()
timeEndinfoconsole.timeEnd()
asserterrorconsole.assert() failures

Tips and Best Practices

Start with the smart summary to see deduplicated errors and warnings:
bdg console
Then drill down with --list or --level as needed.

Next Steps

Network Monitoring

Monitor and filter network requests

DOM Inspection

Query and inspect page elements

API Reference

Complete console command reference

Forms & Interaction

Interact with forms and elements

Build docs developers (and LLMs) love