Skip to content

Add console logs to dev server inspector#19404

Open
zackradisic wants to merge 10 commits intomainfrom
zack/devserver-log-inspector
Open

Add console logs to dev server inspector#19404
zackradisic wants to merge 10 commits intomainfrom
zack/devserver-log-inspector

Conversation

@zackradisic
Copy link
Copy Markdown
Contributor

What does this PR do?

console.log and console.error get added to dev server inspector protocol

Added a test

@robobun
Copy link
Copy Markdown
Collaborator

robobun commented Apr 30, 2025

Updated 7:01 PM PT - May 1st, 2025

@zackradisic, your commit 95866b9 has 4 failures in Build #15959:


🧪   try this PR locally:

bunx bun-pr 19404

Comment on lines +303 to +304
function websocketInspect(logLevel: "l" | "e", values: any[]) {
let str = "l" + logLevel;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The protocol implementation appears to have a small inconsistency. In the websocketInspect function, the message format starts with "l" + logLevel, creating strings like "ll" or "le". However, according to the IncomingMessageId enum in DevServer.zig, the first character should be the message type identifier ('l' for console_log), followed by the log kind.

This double 'l' prefix might be intentional as part of the protocol design, but it's worth confirming that the server-side handler in DevServer.zig correctly expects this format with the duplicated 'l' character at the beginning of console log messages.

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

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.

3 participants