Skip to content

Commit 92bcf97

Browse files
GazizonokiJlucblu
authored andcommitted
Replaced Cout, Cerr, Clog (#119)
1 parent e579884 commit 92bcf97

File tree

169 files changed

+830
-2384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+830
-2384
lines changed

client/impl/ydb_internal/grpc_connections/grpc_connections.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ bool TGRpcConnectionsImpl::StartStatCollecting(NMonitoring::IMetricRegistry* sen
389389
if (auto ptr = dynamic_cast<NMonitoring::TMetricRegistry*>(sensorsRegistry)) {
390390
MetricRegistryPtr_ = ptr;
391391
} else {
392-
Cerr << "Unknown IMetricRegistry impl" << Endl;
392+
std::cerr << "Unknown IMetricRegistry impl" << std::endl;
393393
return false;
394394
}
395395
}

client/impl/ydb_internal/retry/retry.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ class TRetryContextBase : TNonCopyable {
4747

4848
void LogRetry(const TStatus& status) {
4949
if (Settings_.Verbose_) {
50-
Cerr << "Previous query attempt was finished with unsuccessful status "
51-
<< status.GetStatus() << ": " << status.GetIssues().ToString(true) << Endl;
52-
Cerr << "Sending retry attempt " << RetryNumber_ << " of " << Settings_.MaxRetries_ << Endl;
50+
std::cerr << "Previous query attempt was finished with unsuccessful status "
51+
<< ToString(status.GetStatus()) << ": " << status.GetIssues().ToString(true) << std::endl;
52+
std::cerr << "Sending retry attempt " << RetryNumber_ << " of " << Settings_.MaxRetries_ << std::endl;
5353
}
5454
}
5555

client/ydb_coordination/coordination_ut.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace {
2424
{
2525
Y_UNUSED(context);
2626

27-
Cerr << "ListEndpoints: " << request->ShortDebugString() << Endl;
27+
std::cerr << "ListEndpoints: " << request->ShortDebugString() << std::endl;
2828

2929
const auto* result = MockResults.FindPtr(request->database());
3030
Y_ABORT_UNLESS(result, "Mock service doesn't have a result for database '%s'", request->database().c_str());
@@ -50,7 +50,7 @@ namespace {
5050
{
5151
Y_UNUSED(context);
5252

53-
Cerr << "Session stream started" << Endl;
53+
std::cerr << "Session stream started" << std::endl;
5454

5555
Ydb::Coordination::SessionRequest request;
5656

@@ -60,7 +60,7 @@ namespace {
6060
// Disconnected before the request was sent
6161
return grpc::Status::OK;
6262
}
63-
Cerr << "Session request: " << request.ShortDebugString() << Endl;
63+
std::cerr << "Session request: " << request.ShortDebugString() << std::endl;
6464
Y_ABORT_UNLESS(request.has_session_start(), "Expected session start");
6565
auto& start = request.session_start();
6666
uint64_t sessionId = start.session_id();
@@ -77,7 +77,7 @@ namespace {
7777

7878
size_t pings_received = 0;
7979
while (stream->Read(&request)) {
80-
Cerr << "Session request: " << request.ShortDebugString() << Endl;
80+
std::cerr << "Session request: " << request.ShortDebugString() << std::endl;
8181
Y_ABORT_UNLESS(request.has_ping(), "Only ping requests are supported");
8282
if (++pings_received <= 2) {
8383
// Only reply to the first 2 ping requests
@@ -134,11 +134,11 @@ Y_UNIT_TEST_SUITE(Coordination) {
134134

135135
// Start our mock discovery service
136136
ui16 discoveryPort = pm.GetPort();
137-
std::string discoveryAddr = TYdbStringBuilder() << "0.0.0.0:" << discoveryPort;
137+
std::string discoveryAddr = TStringBuilder() << "0.0.0.0:" << discoveryPort;
138138
auto discoveryServer = StartGrpcServer(discoveryAddr, discoveryService);
139139

140140
auto config = TDriverConfig()
141-
.SetEndpoint(TYdbStringBuilder() << "localhost:" << discoveryPort)
141+
.SetEndpoint(TStringBuilder() << "localhost:" << discoveryPort)
142142
.SetDatabase("/Root/My/DB");
143143
TDriver driver(config);
144144
TClient client(driver);
@@ -152,7 +152,7 @@ Y_UNIT_TEST_SUITE(Coordination) {
152152
auto endTimestamp = TInstant::Now();
153153
auto elapsed = endTimestamp - startTimestamp;
154154

155-
Cerr << "Got: " << res.GetStatus() << ": " << res.GetIssues().ToString() << Endl;
155+
std::cerr << "Got: " << ToString(res.GetStatus()) << ": " << res.GetIssues().ToString() << std::endl;
156156

157157
// Both connection and session timeout return EStatus::TIMEOUT
158158
UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::TIMEOUT, res.GetIssues().ToString());
@@ -168,7 +168,7 @@ Y_UNIT_TEST_SUITE(Coordination) {
168168
TMockCoordinationService coordinationService;
169169
ui16 coordinationPort = pm.GetPort();
170170
auto coordinationServer = StartGrpcServer(
171-
TYdbStringBuilder() << "0.0.0.0:" << coordinationPort,
171+
TStringBuilder() << "0.0.0.0:" << coordinationPort,
172172
coordinationService);
173173

174174
// Fill a fake discovery service
@@ -183,12 +183,12 @@ Y_UNIT_TEST_SUITE(Coordination) {
183183
// Start a fake discovery service
184184
ui16 discoveryPort = pm.GetPort();
185185
auto discoveryServer = StartGrpcServer(
186-
TYdbStringBuilder() << "0.0.0.0:" << discoveryPort,
186+
TStringBuilder() << "0.0.0.0:" << discoveryPort,
187187
discoveryService);
188188

189189
// Create a driver and a client
190190
auto config = TDriverConfig()
191-
.SetEndpoint(TYdbStringBuilder() << "localhost:" << discoveryPort)
191+
.SetEndpoint(TStringBuilder() << "localhost:" << discoveryPort)
192192
.SetDatabase("/Root/My/DB");
193193
TDriver driver(config);
194194
TClient client(driver);
@@ -197,7 +197,7 @@ Y_UNIT_TEST_SUITE(Coordination) {
197197
auto stoppedFuture = stoppedPromise.GetFuture();
198198
auto settings = TSessionSettings()
199199
.OnStateChanged([](auto state) {
200-
Cerr << "Session state: " << state << Endl;
200+
std::cerr << "Session state: " << ToString(state) << std::endl;
201201
})
202202
.OnStopped([stoppedPromise]() mutable {
203203
stoppedPromise.SetValue();
@@ -221,7 +221,7 @@ Y_UNIT_TEST_SUITE(Coordination) {
221221

222222
// Check the last failure stored in a session
223223
auto res2 = session.Close().ExtractValueSync();
224-
Cerr << "Close: " << res2.GetStatus() << ": " << res2.GetIssues().ToString() << Endl;
224+
std::cerr << "Close: " << ToString(res2.GetStatus()) << ": " << res2.GetIssues().ToString() << std::endl;
225225
UNIT_ASSERT_VALUES_EQUAL_C(res2.GetStatus(), EStatus::TIMEOUT, res2.GetIssues().ToString());
226226
}
227227

@@ -232,7 +232,7 @@ Y_UNIT_TEST_SUITE(Coordination) {
232232
TMockCoordinationService coordinationService;
233233
ui16 coordinationPort = pm.GetPort();
234234
auto coordinationServer = StartGrpcServer(
235-
TYdbStringBuilder() << "0.0.0.0:" << coordinationPort,
235+
TStringBuilder() << "0.0.0.0:" << coordinationPort,
236236
coordinationService);
237237

238238
// Fill a fake discovery service
@@ -247,12 +247,12 @@ Y_UNIT_TEST_SUITE(Coordination) {
247247
// Start a fake discovery service
248248
ui16 discoveryPort = pm.GetPort();
249249
auto discoveryServer = StartGrpcServer(
250-
TYdbStringBuilder() << "0.0.0.0:" << discoveryPort,
250+
TStringBuilder() << "0.0.0.0:" << discoveryPort,
251251
discoveryService);
252252

253253
// Create a driver and a client
254254
auto config = TDriverConfig()
255-
.SetEndpoint(TYdbStringBuilder() << "localhost:" << discoveryPort)
255+
.SetEndpoint(TStringBuilder() << "localhost:" << discoveryPort)
256256
.SetDatabase("/Root/My/DB");
257257
std::optional<TDriver> driver(std::in_place, config);
258258
std::optional<TClient> client(std::in_place, *driver);
@@ -261,7 +261,7 @@ Y_UNIT_TEST_SUITE(Coordination) {
261261
auto stoppedFuture = stoppedPromise.GetFuture();
262262
auto settings = TSessionSettings()
263263
.OnStateChanged([](auto state) {
264-
Cerr << "Session state: " << state << Endl;
264+
std::cerr << "Session state: " << ToString(state) << std::endl;
265265
})
266266
.OnStopped([stoppedPromise]() mutable {
267267
stoppedPromise.SetValue();
@@ -288,7 +288,7 @@ Y_UNIT_TEST_SUITE(Coordination) {
288288

289289
// Check the last failure stored in a session
290290
auto res2 = session.Close().ExtractValueSync();
291-
Cerr << "Close: " << res2.GetStatus() << ": " << res2.GetIssues().ToString() << Endl;
291+
std::cerr << "Close: " << ToString(res2.GetStatus()) << ": " << res2.GetIssues().ToString() << std::endl;
292292
UNIT_ASSERT_VALUES_EQUAL_C(res2.GetStatus(), EStatus::CLIENT_CANCELLED, res2.GetIssues().ToString());
293293
}
294294

client/ydb_driver/driver_ut.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace {
2929
{
3030
Y_UNUSED(context);
3131

32-
Cerr << "ListEndpoints: " << request->ShortDebugString() << Endl;
32+
std::cerr << "ListEndpoints: " << request->ShortDebugString() << std::endl;
3333

3434
const auto* result = MockResults.FindPtr(request->database());
3535
Y_ABORT_UNLESS(result, "Mock service doesn't have a result for database '%s'", request->database().c_str());
@@ -54,7 +54,7 @@ namespace {
5454
{
5555
Y_UNUSED(context);
5656

57-
Cerr << "CreateSession: " << request->ShortDebugString() << Endl;
57+
std::cerr << "CreateSession: " << request->ShortDebugString() << std::endl;
5858

5959
Ydb::Table::CreateSessionResult result;
6060
result.set_session_id("my-session-id");
@@ -127,9 +127,9 @@ Y_UNIT_TEST_SUITE(CppGrpcClientSimpleTest) {
127127
};
128128

129129
std::vector<std::string> InvalidTokens = {
130-
std::string('\t'),
131-
std::string('\n'),
132-
std::string('\r')
130+
std::string("\t"),
131+
std::string("\n"),
132+
std::string("\r")
133133
};
134134
for (auto& t : InvalidTokens) {
135135
UNIT_ASSERT_EQUAL(checkToken(t), EStatus::CLIENT_UNAUTHENTICATED);
@@ -151,7 +151,7 @@ Y_UNIT_TEST_SUITE(CppGrpcClientSimpleTest) {
151151
TMockTableService tableService;
152152
ui16 tablePort = pm.GetPort();
153153
auto tableServer = StartGrpcServer(
154-
TYdbStringBuilder() << "127.0.0.1:" << tablePort,
154+
TStringBuilder() << "127.0.0.1:" << tablePort,
155155
tableService);
156156

157157
// Start our mock discovery service
@@ -165,12 +165,12 @@ Y_UNIT_TEST_SUITE(CppGrpcClientSimpleTest) {
165165
}
166166
ui16 discoveryPort = pm.GetPort();
167167
auto discoveryServer = StartGrpcServer(
168-
TYdbStringBuilder() << "0.0.0.0:" << discoveryPort,
168+
TStringBuilder() << "0.0.0.0:" << discoveryPort,
169169
discoveryService);
170170

171171
auto driver = TDriver(
172172
TDriverConfig()
173-
.SetEndpoint(TYdbStringBuilder() << "localhost:" << discoveryPort)
173+
.SetEndpoint(TStringBuilder() << "localhost:" << discoveryPort)
174174
.SetDatabase("/Root/My/DB"));
175175
auto client = NTable::TTableClient(driver);
176176
auto sessionFuture = client.CreateSession();

0 commit comments

Comments
 (0)