OPEN SOURCE · MOBILE WEB DEVTOOLS

Bugs happen on mobile.
Keep the clues in view.

Logs, requests, page elements and storage in one panel. Export the evidence and continue debugging on your desktop.

MIT licensedNo runtime dependenciesv0.2.2 preview
● ● ●GravScope / Feature preview01
LogsNetworkElementsStorage
11:24:08 INFO

Page ready { route: "/checkout" }

11:24:09 FETCH

200 /api/products 124 ms

11:24:10 ERROR

Payment request failed

▸ Error { message, stack }
Find the clues → Export a reportJSON / HTML

From spotting an error
to keeping the evidence.

01 / ObserveFilter logs and requests quickly
02 / InvestigateExpand objects, inspect elements and storage
03 / ShareReview redaction and save an offline report

PLAYGROUND

Trigger it. Inspect it.

Running the published npm release 0.2.2.
Sample data is limited to this demo page.

01

Logs and complex objects

Generate nested objects, warnings and errors. Try filtering and expanding values.

02

Requests and responses

Fetch a sample JSON file from this site, then inspect its response in the Network panel.

03

Elements and local storage

Write sample values prefixed with gravscope-demo, or pick an element on the page.

04

Take the evidence with you

Open Logs, choose More → Export in the bottom toolbar, then preview and save HTML or JSON.

Choose a scenario to begin. The panel loads only when you click.

Sample errors will not break the page. Download and copy support depend on your browser; review automatic redaction before sharing a report.

REPORT REPLAY

Bring mobile evidence to your desktop.

Choose or drop a JSON report exported by GravScope. It is read locally in this browser: no upload, no execution of report content, and no replayed requests. Maximum 5 MB and 10,000 records per category.

Choose a local report, or drop it here.

Environment and report metadata

QUICK START

One snippet. More insight.

Enable only in development or controlled testing environments.
Modern build by default, with a pinned CDN version.
View all initialization options ↓ · View API methods ↓

Install with npm

npm install @geekgravity/gravscope
import GravScope from '@geekgravity/gravscope/modern';

const panel = new GravScope({ theme: 'auto' });
console.log('Hello GravScope');

// When debugging is finished
panel.destroy();

Load from a CDN

Legacy build: replace gravscope.modern.iife.js with gravscope.iife.js. ES5 syntax does not guarantee compatibility with every older WebView.

CONFIGURATION

Every initialization option.

Full reference and examples ↗

All options are optional. The panel starts collapsed; capture begins during initialization.

OptionTypeDefaultDescription
theme'light' / 'dark' / 'auto''auto'Panel theme; auto follows system color-scheme changes.
lang'zh' / 'en'Auto-detectedReads navigator.language: Chinese for languages starting with zh, English otherwise.
defaultPluginsBuiltinPlugin[]['network', 'errors', 'element', 'storage', 'system', 'timeline', 'performance', 'streams']Adds Network, Errors, Elements, Storage, System, Timeline, Performance and Streams in array order. Duplicates are removed and unknown entries ignored. Use [] to keep only Logs.
preserveLogsbooleanfalse; uses the session preference when omittedSince 0.2.0: preserve redacted logs across reloads; supports runtime updates.
capturePartial<CaptureOptions>console / network / error / navigation / performance / realtime: all trueSince 0.2.0: control capture channels independently with partial runtime updates.
maxLogNumbernumber1000Maximum retained log records. Oldest records are evicted when exceeded; this is not a byte limit.
maxNetworkNumbernumber200Maximum retained network records. Oldest records are evicted when exceeded.
entryButtonbooleantrueShow the floating entry button. When false, show() and showTab() can still open the panel.
exportEnabledbooleantrueShow export actions in the log toolbar. false also hides report-preview copy and download actions. getReport() and individual log copying remain available.
networkIgnorestring[][]Exclude new requests and connections by URL substring; replaceable at runtime.
redactKeysstring[][]Additional field names to redact in reports and history; replaceable at runtime.
onExport(file: ExportFile) => void | Promise<void>undefinedTake over HTML/JSON export. Initialization only; see native export below for parameters and acknowledgment semantics.
targetHTMLElement / string / nullnull → document.bodyMount element or CSS selector. A selector must match an HTMLElement at mount time or an error is thrown. Omit or pass null to use body.
onReady() => voidundefinedCalled once, without arguments, after the UI mounts. It does not mean page resources or requests have finished loading.

Use positive integer limits. Fractions are rounded down, with a minimum of one. At initialization, zero, negative or non-finite values use defaults. Hiding the panel, entry button or export UI does not stop capture; call destroy() when done.

onReady may run synchronously; access the instance via GravScope.current. Runtime setOption() supports theme, maxLogNumber, maxNetworkNumber, entryButton, preserveLogs, capture, networkIgnore and redactKeys. Other options require a new instance.

API REFERENCE

Methods, parameters and return values.

Full API and plugin reference ↗

Examples assume const panel = new GravScope(). All methods are synchronous; void means no return value and no chaining.

show()

Parameters: none.

Returns: void

Open the panel and reset the unread count without clearing logs.

panel.show();
hide()

Parameters: none.

Returns: void

Collapse the panel; capture continues.

panel.hide();
showTab(id)

Parameters: id: string, the ID of an installed panel.

Returns: void

Select a tab and open the panel. Built-in IDs: log, network, errors, element, storage, system, timeline, performance, streams. Custom panels use plugin.id. An unknown ID keeps the current tab but still opens the panel.

panel.showTab('network');
setOption(key, value)

Parameters: key: 'theme', value: 'light' / 'dark' / 'auto'; key: 'maxLogNumber' / 'maxNetworkNumber', value: number; or key: 'entryButton', value: boolean.

Returns: void

Update the theme, retention limit or floating entry immediately. Runtime limits are rounded down with a minimum of one; non-finite values are ignored (unlike initialization defaults). Invalid themes are ignored. Since 0.2.0, also accepts preserveLogs (boolean), capture (Partial<CaptureOptions>), networkIgnore / redactKeys (string[]). Lower limits immediately evict old records. Runtime entryButton updates are available since 0.1.2: false hides it immediately; true shows it only when the panel is collapsed. This does not collapse the panel or stop capture. Non-boolean entryButton values are ignored.

panel.setOption('theme', 'dark');
panel.setOption('maxLogNumber', 500);
panel.setOption('maxNetworkNumber', 100);
// Hide / restore the floating entry
panel.setOption('entryButton', false);
panel.setOption('entryButton', true);
setSystemInfo(key, value)

Parameters: key: string, information name; value: string, displayed content.

Returns: void

Add or replace custom system information by name. Included in the report's custom field; opening System first is not required.

panel.setSystemInfo('Build', '2026.11.04');
panel.setSystemInfo('Environment', 'staging');
getReport(options?)

Parameters: options?: ReportOptions, default {}. Fields are listed below.

Returns: DiagnosticReport

Synchronously return a redacted snapshot without downloading, uploading or opening a report dialog. Available even when exportEnabled is false. A non-finite or negative since value throws.

const report = panel.getReport({
  since: Date.now() - 5 * 60 * 1000,
  includeBodies: false,
});
const json = JSON.stringify(report, null, 2);
addPlugin(plugin)

Parameters: plugin: GravScopePlugin, an instance with its events and tools already configured.

Returns: void

Add a tab and synchronously emit init and render. The ID must be unique; a collision with a built-in or custom plugin throws. Does not automatically select the new tab.

const plugin = new GravScope.Plugin('build', 'Build');
plugin.on('render', element => {
  element.textContent = 'Build 2026.11.04';
});
panel.addPlugin(plugin);
panel.showTab('build');
removePlugin(id)

Parameters: id: string, the plugin ID to remove.

Returns: void

Emit remove and remove the tab; an unknown ID is a no-op. Removing the current tab selects the first remaining tab. If a remove callback throws, the tab is still removed and the error propagates. Removing Network does not stop network capture.

panel.removePlugin('build');
destroy()

Parameters: none.

Returns: void

Remove the UI, emit remove, release capture hooks and listeners owned by the instance, and clear GravScope.current. Safe to repeat. Plugin cleanup errors do not prevent destruction. Create a new instance to resume debugging.

panel.destroy();
const nextPanel = new GravScope();
getReport options and return structure

since: number, default 0. Unix timestamp in milliseconds. Includes logs at or after this time and requests by their start time; not seconds or a duration.

includeBodies: boolean, default false. Include captured request and response bodies. Capture limits and redaction still apply; missing bodies are not fetched again.

schemaVersion: 1: report schema version.

version: string: GravScope library version.

createdAt: string: generation time as an ISO 8601 string.

page: string: redacted current page URL.

device: { userAgent: string; language: string; viewport: string }: browser, language and viewport information.

custom: unknown: redacted custom system information.

logs: unknown[]: retained logs within the time range.

network: unknown[]: retained requests within the time range.

policy: string: capture and redaction limitations.

Fields are redacted and truncated, not original objects. Obtain the report before calling destroy().

Public properties and plugin API

GravScope.current is the current instance or null. GravScope.version and panel.version are read-only version strings. GravScope.Plugin is the plugin constructor.

new GravScopePlugin(id, name)

id: string, a unique non-empty identifier; name: string, the tab label (uses id when empty).

Returns: GravScopePlugin

const plugin = new GravScope.Plugin('build', 'Build');

on(event, handler)

event is an event name listed below; handler is its callback. Adds a listener without replacing existing callbacks.

Returns: this

plugin.on('render', element => { element.textContent = 'Ready'; });

addTool(name, onClick)

name: string, button label; onClick: () => void, click callback with no arguments.

Returns: this

plugin.addTool('Refresh', () => console.info('Refresh requested'));

getTools()

None. Returns a shallow copy of the tools array. Button objects are shared and should not be modified.

Returns: Array<{ name: string; onClick: () => void }>

const labels = plugin.getTools().map(tool => tool.name);

emit(event, ...args)

event is the event name; render requires an HTMLElement, others take no arguments. Runs synchronously in registration order; a thrown error interrupts dispatch and propagates. Normally managed by the panel; manual calls do not switch the UI.

Returns: void

// Manual handler invocation only; does not open the tab.
plugin.emit('show');

init — () => void: runs when the plugin is added, before render.

render — (element: HTMLElement) => void: runs when added; populate the panel using element.

show — () => void: runs when the tab is activated or the panel is shown; may repeat and does not guarantee actual visibility.

hide — () => void: runs when leaving the current tab or calling hide; may repeat.

remove — () => void: clean up owned timers, listeners and other resources on removePlugin or destroy.

Register callbacks and tools before addPlugin(). id and name are read-only strings; an empty id throws. on and addTool return the plugin for chaining. getTools returns a shallow copy. There is no off() method; clean up your listeners and timers in remove. The toolbar reads tools when the tab activates; appending a tool does not immediately redraw it.

Debugging workflow (0.2.0)

The log toolbar keeps Clear, Pause scrolling and Latest visible; other actions are under More. Logs are paged at 200 records plus up to 100 group-context records. Search and copy cover all retained records.

Network supports method and exact status / status-family filters, plus Copy as cURL. Pause log scrolling and resume following after checking the new-entry count. Errors aggregates JavaScript, Promise, resource and console errors.

Capture settings under More independently toggle Console, Network and Errors; setOption('capture', { network: false }) is also supported. Disabling capture neither removes records nor cancels page requests. Re-enabling captures new activity. Available since 0.2.0; report replay also accepts 0.1.2 JSON reports.

Native export and diagnostics (0.2.0)

Timeline, Performance and Streams panels are available. Inspect logs and requests within 30 seconds before and after an error. Network uses 100 records per page. Storage supports search, JSON formatting/validation, explicit saving and deletion confirmation. Performance summarizes slow requests, known sizes and browser-supported long tasks.

capture includes navigation, performance and realtime toggles. Realtime capture observes new WebSocket / EventSource connections, default messages and named SSE events registered by the application. Text is limited to 2,000 characters per entry; activity shares a 1,000-entry retention limit. Business connections are not closed; fetch-based SSE bodies are not buffered.

panel.setOption('networkIgnore', ['/heartbeat', '/analytics']);
panel.setOption('redactKeys', ['phone', 'customerId']);
panel.setOption('capture', { realtime: false });

networkIgnore excludes later requests and new connections by case-sensitive URL substring. redactKeys matches whole field names case-insensitively in reports and history without changing raw records. Both arrays replace previous rules: 1–100 characters per entry, up to 100 entries.

onExport(file): let the host save or share

Initialization only: (file: ExportFile) => void | Promise<void>. Triggered by HTML/JSON export buttons, not by Copy, Select all or getReport(). Available since 0.2.0.

Parameter fieldDescription
requestIdExport task ID for correlating native acknowledgments
filenamegravscope-report-timestamp.html / .json, including the extension
mimeTypetext/html;charset=utf-8 or application/json;charset=utf-8
formathtml / json
contentRedacted text, not a Blob, file path or Base64
new GravScope({
  async onExport(file) {
    // appBridge is provided by the host App; resolve/reject after native completion.
    await window.appBridge.saveDiagnosticFile({
      requestId: file.requestId,
      filename: file.filename,
      mimeType: file.mimeType,
      content: file.content
    });
  }
});

Without a callback, export initiates a browser Blob download. With a callback, it takes full control and no automatic download occurs. Export buttons are disabled while the instance's task is pending, including after reopening the dialog; the task ID and filename remain visible. After 30 seconds, a waiting notice appears. Confirming Cancel waiting only stops the component from waiting; the native operation may continue and retrying may duplicate it. Stale acknowledgments do not overwrite new tasks. Throws or rejections show failure and allow retry/copy, without fallback downloading. Closing the dialog does not cancel native work; callback completion is not treated as proof that a file was saved.

The native host handles UTF-8 encoding, file saving/sharing and acknowledgment. Sending postMessage alone does not prove success. Bridge size limits, chunking, uploads and cancellation belong to the application. File extensions aid recognition but do not provide WebView download support. exportEnabled: false hides export UI only; getReport() remains available.

Clear and reliability (0.2.0)

panel.clearAll(): void takes no arguments. Clears logs, requests, activity, custom system information and saved history, and closes the old report preview. Keeps capture/history preferences, business storage and connections; does not cancel exports already handed to native code. The More menu asks for confirmation; the API runs directly. No-op after destruction.

JSON preview shows UTF-8 byte size. JSON and HTML exports are limited to 5 MiB, with HTML checked again after escaping. getReport() also enforces report size and a 10,000-entry limit each for filtered logs/requests. Exceeding a limit throws ReportLimitError without truncation or calling onExport. Narrow the time range or exclude bodies and retry.

Protected capture APIs are rolled back and disabled per channel with a visible notice; other panels keep working. Capture settings can retry. Logged objects are retained by reference; values may change before expansion or export.

Capture status (0.2.0)

panel.getCaptureStatus() takes no arguments. Returns a copy of six channel states, each with enabled, state and detail. state is enabled / disabled / unavailable / failed, distinguishing active capture, disabled capture, unsupported environments and initialization failure. Changing the copy does not change configuration. Returns disabled states after destruction.

const status = panel.getCaptureStatus();
// Missing records do not prove that no issue occurred when capture is unsupported.
console.log(status.performance.state, status.performance.detail);

The panel shows capture status; capture settings explain coverage. Streams explicitly observes only new connections. This playground uses 0.2.2.

Preserve logs across reloads (0.2.0)

Enable Preserve logs in the log filter bar, or initialize with preserveLogs: true. Toggle at runtime with setOption('preserveLogs', true / false). Available since 0.2.0.

Uses same-origin sessionStorage in the current tab. Off by default; enabling remembers the session preference. Stores up to 200 redacted static log records within about 256 KiB of JSON. Restored records are marked as historical and separated from the new session. Clearing deletes saved content; disabling deletes saved history but keeps currently displayed records.

Network requests and command source are not saved. Recovery may be incomplete if storage is unavailable or the page is forcibly terminated.

Read the full reference ↗

Page performance report (0.2.1)

Performance and System show DNS, connection, TLS, request/navigation TTFB, download, DOM readiness, Load, FP/FCP and document sizes. Search, copy and JSON/HTML export are supported; replay includes the performance field.

const report = panel.getReport();
console.log(report.performance?.metrics.load);

value is a number or null; unit is ms / bytes; state is available / pending / unavailable. Zero is valid; missing or unsupported values are not fabricated. Load does not mean application readiness. These are browser snapshots for the current document, not standard LCP/CLS/INP scores, SPA route timings or BFCache restoration timings. Disabling long-task capture does not disable these snapshots; clearing diagnostics does not clear browser timings.

iframe history is isolated by fixed frame position, with source metadata in reports. Use caution with dynamic insertion, removal or reordering. Cross-frame log aggregation is not included.

FIELD GUIDE

A small tool with clear boundaries.

Read the full English documentation ↗
Configure panels and plugins

Supports light, dark and system themes, plus Chinese and English. Logs is always enabled; other panels are configurable. Hiding Network does not stop network capture. Add your own tools through GravScopePlugin.

new GravScope({
  theme: 'auto', lang: 'en',
  maxLogNumber: 1000,
  maxNetworkNumber: 200
});
What is in an exported report?

Retained logs, requests and device information. Request and response bodies are excluded by default; local storage and command source are excluded. Common credentials and URL parameter values are masked, but not all sensitive business information can be recognized. Object values reflect export time; reports are not session recordings.

const report = panel.getReport({
  since: Date.now() - 5 * 60 * 1000,
  includeBodies: false
});
Network previews and browser support

fetch response previews read up to about 100 KB; SSE bodies are not buffered. Cross-origin response visibility follows browser restrictions. Device compatibility, long-running performance and mobile downloads remain under validation; try it on your target devices first.

Safe use and feedback

The command line runs JavaScript in the current page. Do not enable it for end users by default. GravScope does not automatically upload diagnostic reports. Demo interactions access this site's static resources and may write sample local storage.

Report an issue with device details ↗

Try it on a real phone.

Send this site to your phone browser to try touch interactions and diagnostic exports.

Scan to open the GravScope playground on your phone

Resource loading states (0.2.2)

Lazy images show “Lazy load · unconfirmed”. Removed images, or resources unresolved after 30 seconds, show “State unknown”, not failure or cancellation. Later load/error events or timing entries can still update them. Unconfirmed resources do not trigger panel thumbnail requests.