Skip to content

Add takeoverConsole for complete console integration#80

Merged
johncarmack1984 merged 2 commits into
mainfrom
console-takeover
Jan 14, 2026
Merged

Add takeoverConsole for complete console integration#80
johncarmack1984 merged 2 commits into
mainfrom
console-takeover

Conversation

@johncarmack1984
Copy link
Copy Markdown
Collaborator

@johncarmack1984 johncarmack1984 commented Jan 14, 2026

Summary

Add takeoverConsole() function that completely takes over the webview console.

Logging methods (routed to Rust tracing):

  • log, debug, info, warn, error, trace - standard logging
  • assert - logs error if condition is false
  • dir, dirxml, table - object inspection (mapped to debug level)

UI/utility methods (NOT replaced - zero IPC overhead):

  • clear, count, countReset, group, groupCollapsed, groupEnd, time, timeEnd, timeLog
  • These continue to call native console directly

All Rust tracing events are output to the original console methods, creating a unified logging pipeline without infinite loops.

Usage

import { takeoverConsole } from '@fltsci/tauri-plugin-tracing';

const restore = await takeoverConsole();

console.log('Goes to Rust, then back to console');
console.table({ a: 1, b: 2 }); // Object inspection via tracing
console.assert(false, 'Logs error via tracing');
console.time('timer'); // Native - no IPC overhead

restore();

Test plan

  • pnpm lint passes
  • pnpm test (20 tests pass)

Routes all console calls through Rust tracing and outputs Rust logs
to the original console methods, creating a unified logging pipeline.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 14, 2026

Package Changes Through f757777

There are 2 changes which include tracing with prerelease, tracing-js with prerelease

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
tracing 0.2.0-canary.18 0.2.0-canary.19
tracing-js 0.2.0-canary.18 0.2.0-canary.19

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@johncarmack1984 johncarmack1984 force-pushed the console-takeover branch 4 times, most recently from 2c5a565 to 76ff460 Compare January 14, 2026 04:55
@johncarmack1984 johncarmack1984 merged commit 7099260 into main Jan 14, 2026
7 checks passed
@johncarmack1984 johncarmack1984 deleted the console-takeover branch January 14, 2026 05:00
@github-actions github-actions Bot mentioned this pull request Jan 14, 2026
johncarmack1984 pushed a commit that referenced this pull request Jan 14, 2026
# Version Updates

Merging this PR will release new versions of the following packages
based on your change files.




# tracing

## [0.2.0-canary.19]
- 7099260 (#80 by @johncarmack1984) Add `takeoverConsole()` function
that completely takes over the webview console, routing all logs through
Rust tracing and back to the original console methods.



# tracing-js

## [0.2.0-canary.19]
- 7099260 (#80 by @johncarmack1984) Add `takeoverConsole()` function
that completely takes over the webview console, routing all logs through
Rust tracing and back to the original console methods.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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