File tree Expand file tree Collapse file tree 4 files changed +635
-41
lines changed Expand file tree Collapse file tree 4 files changed +635
-41
lines changed Original file line number Diff line number Diff line change @@ -59,14 +59,30 @@ struct ClientInfo {
59
59
uint32_t client_revision = 0 ;
60
60
};
61
61
62
+ std::ostream& operator <<(std::ostream& os, const Endpoint& endpoint) {
63
+ return os << endpoint.host << " :" << endpoint.port ;
64
+ }
65
+
62
66
std::ostream& operator <<(std::ostream& os, const ClientOptions& opt) {
63
- os << " Client(" << opt.user << ' @' << opt.host << " :" << opt.port
64
- << " Endpoints :" ;
65
- for (size_t i = 0 ; i < opt.endpoints .size (); i++)
66
- os << opt.user << ' @' << opt.endpoints [i].host << " :" << opt.endpoints [i].port
67
+ os << " Client("
68
+ << " Endpoints : [" ;
69
+ size_t extra_endpoints = 0 ;
70
+
71
+ if (!opt.host .empty ()) {
72
+ extra_endpoints = 1 ;
73
+ os << opt.user << ' @' << Endpoint{opt.host , opt.port };
74
+
75
+ if (opt.endpoints .size ())
76
+ os << " , " ;
77
+ }
78
+
79
+ for (size_t i = 0 ; i < opt.endpoints .size (); i++) {
80
+ os << opt.user << ' @' << opt.endpoints [i]
67
81
<< ((i == opt.endpoints .size () - 1 ) ? " " : " , " );
82
+ }
68
83
69
- os << " ping_before_query:" << opt.ping_before_query
84
+ os << " ] (" << opt.endpoints .size () + extra_endpoints << " items )"
85
+ << " ping_before_query:" << opt.ping_before_query
70
86
<< " send_retries:" << opt.send_retries
71
87
<< " retry_timeout:" << opt.retry_timeout .count ()
72
88
<< " compression_method:"
Original file line number Diff line number Diff line change @@ -220,6 +220,7 @@ struct ClientOptions {
220
220
};
221
221
222
222
std::ostream& operator <<(std::ostream& os, const ClientOptions& options);
223
+ std::ostream& operator <<(std::ostream& os, const Endpoint& options);
223
224
224
225
class SocketFactory ;
225
226
You can’t perform that action at this time.
0 commit comments