Skip to content

Commit bd9c244

Browse files
committed
Improve protobuf debugging infrastructure.
1 parent 4399d33 commit bd9c244

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

cdk/protocol/mysqlx/protocol.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ void Op_rcv::process_payload()
712712
}
713713
}
714714

715-
#ifdef DEBUG_PROTOBUF2
715+
#ifdef DEBUG_PROTOBUF
716716

717717
using std::cerr;
718718
using std::endl;

cdk/protocol/mysqlx/session.cc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
#include "protocol.h"
3232
#include "builders.h"
3333

34+
PUSH_SYS_WARNINGS
35+
#include <iostream>
36+
POP_SYS_WARNINGS
3437

3538
PUSH_PB_WARNINGS
3639
#include "protobuf/mysqlx_session.pb.h"
@@ -251,6 +254,18 @@ void process_notice<notice_type::SessionStateChange>(
251254
if (!msg.ParseFromString(std::string(notice.begin(), notice.end())))
252255
THROW("Could not parse notice payload");
253256

257+
#ifdef DEBUG_PROTOBUF
258+
259+
using std::cerr;
260+
using std::endl;
261+
262+
cerr << endl;
263+
cerr << "<--- Notice payload:" << endl;
264+
cerr << msg.DebugString();
265+
cerr << "<---" << endl << endl;
266+
267+
#endif
268+
254269
switch (msg.param())
255270
{
256271
case Mysqlx::Notice::SessionStateChanged::CLIENT_ID_ASSIGNED:
@@ -315,6 +330,18 @@ void process_notice<notice_type::Warning>(
315330
if (!msg.ParseFromString(std::string(notice.begin(), notice.end())))
316331
THROW("Could not parse notice payload");
317332

333+
#ifdef DEBUG_PROTOBUF
334+
335+
using std::cerr;
336+
using std::endl;
337+
338+
cerr << endl;
339+
cerr << "<--- Notice payload:" << endl;
340+
cerr << msg.DebugString();
341+
cerr << "<---" << endl << endl;
342+
343+
#endif
344+
318345
short int level;
319346

320347
switch (msg.level())

0 commit comments

Comments
 (0)