Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d1b750d

Browse filesBrowse files
TimothyGutargos
authored andcommitted
inspector: add debugging for WebSocket messages
PR-URL: #21473 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 7d2fe5d commit d1b750d
Copy full SHA for d1b750d

File tree

Expand file treeCollapse file tree

2 files changed

+9
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-3
lines changed
Open diff view settings
Collapse file

‎src/env.h‎

Copy file name to clipboardExpand all lines: src/env.h
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,10 @@ struct ContextInfo {
415415
};
416416

417417
// Listing the AsyncWrap provider types first enables us to cast directly
418-
// from a provider type to a debug category. Currently no other debug
419-
// categories are available.
418+
// from a provider type to a debug category.
420419
#define DEBUG_CATEGORY_NAMES(V) \
421-
NODE_ASYNC_PROVIDER_TYPES(V)
420+
NODE_ASYNC_PROVIDER_TYPES(V) \
421+
V(INSPECTOR_SERVER)
422422

423423
enum class DebugCategory {
424424
#define V(name) name,
Collapse file

‎src/inspector_io.cc‎

Copy file name to clipboardExpand all lines: src/inspector_io.cc
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ void InspectorIo::SwapBehindLock(MessageQueue<ActionType>* vector1,
314314

315315
void InspectorIo::PostIncomingMessage(InspectorAction action, int session_id,
316316
const std::string& message) {
317+
Debug(parent_env_, DebugCategory::INSPECTOR_SERVER,
318+
">>> %s\n", message.c_str());
317319
if (AppendMessage(&incoming_message_queue_, action, session_id,
318320
Utf8ToStringView(message))) {
319321
Agent* agent = main_thread_req_->second;
@@ -395,6 +397,10 @@ void InspectorIo::MainThreadReqAsyncCb(uv_async_t* req) {
395397

396398
void InspectorIo::Write(TransportAction action, int session_id,
397399
const StringView& inspector_message) {
400+
std::string message_str =
401+
protocol::StringUtil::StringViewToUtf8(inspector_message);
402+
Debug(parent_env_, DebugCategory::INSPECTOR_SERVER,
403+
"<<< %s\n", message_str.c_str());
398404
AppendMessage(&outgoing_message_queue_, action, session_id,
399405
StringBuffer::create(inspector_message));
400406
int err = uv_async_send(&thread_req_);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.