summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2018-06-22 14:24:54 -0400
committerTimothy Gu <timothygu99@gmail.com>2018-06-25 23:18:11 -0400
commit8836a0d780d8dc3f16d9721fdd7ee9a3ffc33855 (patch)
tree92324160c5c579b591c1f8cb0ee4aafb7085fd60 /src
parent65f617314d1ea2df8b9e16fb7e7078b5913c749c (diff)
downloadandroid-node-v8-8836a0d780d8dc3f16d9721fdd7ee9a3ffc33855.tar.gz
android-node-v8-8836a0d780d8dc3f16d9721fdd7ee9a3ffc33855.tar.bz2
android-node-v8-8836a0d780d8dc3f16d9721fdd7ee9a3ffc33855.zip
inspector: add debugging for WebSocket messages
PR-URL: https://github.com/nodejs/node/pull/21473 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/env.h6
-rw-r--r--src/inspector_io.cc6
2 files changed, 9 insertions, 3 deletions
diff --git a/src/env.h b/src/env.h
index 5a2c9e968f..a0670db3ed 100644
--- a/src/env.h
+++ b/src/env.h
@@ -415,10 +415,10 @@ struct ContextInfo {
};
// Listing the AsyncWrap provider types first enables us to cast directly
-// from a provider type to a debug category. Currently no other debug
-// categories are available.
+// from a provider type to a debug category.
#define DEBUG_CATEGORY_NAMES(V) \
- NODE_ASYNC_PROVIDER_TYPES(V)
+ NODE_ASYNC_PROVIDER_TYPES(V) \
+ V(INSPECTOR_SERVER)
enum class DebugCategory {
#define V(name) name,
diff --git a/src/inspector_io.cc b/src/inspector_io.cc
index 01d78d177d..78ecce7398 100644
--- a/src/inspector_io.cc
+++ b/src/inspector_io.cc
@@ -314,6 +314,8 @@ void InspectorIo::SwapBehindLock(MessageQueue<ActionType>* vector1,
void InspectorIo::PostIncomingMessage(InspectorAction action, int session_id,
const std::string& message) {
+ Debug(parent_env_, DebugCategory::INSPECTOR_SERVER,
+ ">>> %s\n", message.c_str());
if (AppendMessage(&incoming_message_queue_, action, session_id,
Utf8ToStringView(message))) {
Agent* agent = main_thread_req_->second;
@@ -395,6 +397,10 @@ void InspectorIo::MainThreadReqAsyncCb(uv_async_t* req) {
void InspectorIo::Write(TransportAction action, int session_id,
const StringView& inspector_message) {
+ std::string message_str =
+ protocol::StringUtil::StringViewToUtf8(inspector_message);
+ Debug(parent_env_, DebugCategory::INSPECTOR_SERVER,
+ "<<< %s\n", message_str.c_str());
AppendMessage(&outgoing_message_queue_, action, session_id,
StringBuffer::create(inspector_message));
int err = uv_async_send(&thread_req_);