Skip to content

Commit 5d48011

Browse files
santigimenoRafaelGSS
authored andcommitted
src: print nghttp2 logs when using --debug-nghttp2
PR-URL: #45209 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
1 parent 8d7aa53 commit 5d48011

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

node.gyp

+3
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,9 @@
859859
},
860860
],
861861
}],
862+
[ 'debug_nghttp2==1', {
863+
'defines': [ 'NODE_DEBUG_NGHTTP2=1' ]
864+
}],
862865
],
863866
'actions': [
864867
{

src/node_http2.cc

+10
Original file line numberDiff line numberDiff line change
@@ -3179,6 +3179,12 @@ void SetCallbackFunctions(const FunctionCallbackInfo<Value>& args) {
31793179
#undef SET_FUNCTION
31803180
}
31813181

3182+
#ifdef NODE_DEBUG_NGHTTP2
3183+
void NgHttp2Debug(const char* format, va_list args) {
3184+
vfprintf(stderr, format, args);
3185+
}
3186+
#endif
3187+
31823188
void Http2State::MemoryInfo(MemoryTracker* tracker) const {
31833189
tracker->TrackField("root_buffer", root_buffer);
31843190
}
@@ -3344,6 +3350,10 @@ void Initialize(Local<Object> target,
33443350
#undef V
33453351

33463352
target->Set(context, env->constants_string(), constants).Check();
3353+
3354+
#ifdef NODE_DEBUG_NGHTTP2
3355+
nghttp2_set_debug_vprintf_callback(NgHttp2Debug);
3356+
#endif
33473357
}
33483358
} // namespace http2
33493359
} // namespace node

0 commit comments

Comments
 (0)