Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: print nghttp2 logs when using debug-nghttp2 #45209

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions node.gyp
Expand Up @@ -859,6 +859,9 @@
},
],
}],
[ 'debug_nghttp2==1', {
'defines': [ 'NODE_DEBUG_NGHTTP2=1' ]
}],
],
'actions': [
{
Expand Down
10 changes: 10 additions & 0 deletions src/node_http2.cc
Expand Up @@ -3179,6 +3179,12 @@ void SetCallbackFunctions(const FunctionCallbackInfo<Value>& args) {
#undef SET_FUNCTION
}

#ifdef NODE_DEBUG_NGHTTP2
void NgHttp2Debug(const char* format, va_list args) {
vfprintf(stderr, format, args);
}
#endif

void Http2State::MemoryInfo(MemoryTracker* tracker) const {
tracker->TrackField("root_buffer", root_buffer);
}
Expand Down Expand Up @@ -3344,6 +3350,10 @@ void Initialize(Local<Object> target,
#undef V

target->Set(context, env->constants_string(), constants).Check();

#ifdef NODE_DEBUG_NGHTTP2
nghttp2_set_debug_vprintf_callback(NgHttp2Debug);
#endif
}
} // namespace http2
} // namespace node
Expand Down
1 change: 1 addition & 0 deletions vcbuild.bat
Expand Up @@ -197,6 +197,7 @@ if defined link_module set configure_flags=%configure_flags% %link_module%
if defined i18n_arg set configure_flags=%configure_flags% --with-intl=%i18n_arg%
if defined config_flags set configure_flags=%configure_flags% %config_flags%
if defined target_arch set configure_flags=%configure_flags% --dest-cpu=%target_arch%
if defined debug_nghttp2 set configure_flags=%configure_flags% --debug-nghttp2
Copy link
Member

Choose a reason for hiding this comment

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

Does it is needed? Looks like line 142 does everything needed

if /i "%1"=="debug-nghttp2" set debug_nghttp2=1&goto arg-ok

Copy link
Member Author

Choose a reason for hiding this comment

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

Apparently it is. We need to pass the --debug-nghttp2 option to configure so it reaches gyp.

if defined openssl_no_asm set configure_flags=%configure_flags% --openssl-no-asm
if defined DEBUG_HELPER set configure_flags=%configure_flags% --verbose
if "%target_arch%"=="x86" if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set configure_flags=%configure_flags% --no-cross-compiling
Expand Down