Skip to content

Commit f5c0187

Browse files
committed
fix clang-tidy performance-avoid-endl warnings
1 parent 016155f commit f5c0187

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

examples/otlp/http_instrumented_main.cc

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,46 +103,45 @@ class MyThreadInstrumentation : public opentelemetry::sdk::common::ThreadInstrum
103103
{
104104
std::cout << ", priority " << priority_;
105105
}
106-
std::cout << std::endl << std::flush;
106+
std::cout << "\n" << std::flush;
107107
}
108108

109109
void OnEnd() override
110110
{
111111
std::lock_guard<std::mutex> lock_guard(serialize);
112-
std::cout << "OnEnd() thread " << thread_name_ << ", id " << std::this_thread::get_id()
113-
<< std::endl
112+
std::cout << "OnEnd() thread " << thread_name_ << ", id " << std::this_thread::get_id() << "\n"
114113
<< std::flush;
115114
}
116115

117116
void BeforeWait() override
118117
{
119118
std::lock_guard<std::mutex> lock_guard(serialize);
120119
std::cout << "BeforeWait() thread " << thread_name_ << ", id " << std::this_thread::get_id()
121-
<< ", waiting" << std::endl
120+
<< ", waiting\n"
122121
<< std::flush;
123122
}
124123

125124
void AfterWait() override
126125
{
127126
std::lock_guard<std::mutex> lock_guard(serialize);
128127
std::cout << "AfterWait() thread " << thread_name_ << ", id " << std::this_thread::get_id()
129-
<< ", done waiting" << std::endl
128+
<< ", done waiting\n"
130129
<< std::flush;
131130
}
132131

133132
void BeforeLoad() override
134133
{
135134
std::lock_guard<std::mutex> lock_guard(serialize);
136135
std::cout << "BeforeLoad() thread " << thread_name_ << ", id " << std::this_thread::get_id()
137-
<< ", about to work" << std::endl
136+
<< ", about to work\n"
138137
<< std::flush;
139138
}
140139

141140
void AfterLoad() override
142141
{
143142
std::lock_guard<std::mutex> lock_guard(serialize);
144143
std::cout << "AfterLoad() thread " << thread_name_ << ", id " << std::this_thread::get_id()
145-
<< ", done working" << std::endl
144+
<< ", done working\n"
146145
<< std::flush;
147146
}
148147

@@ -341,25 +340,25 @@ int main(int argc, char *argv[])
341340
logger_opts.url = "http://localhost:4318/v1/logs";
342341
}
343342

344-
std::cout << "Initializing opentelemetry-cpp" << std::endl << std::flush;
343+
std::cout << "Initializing opentelemetry-cpp\n" << std::flush;
345344

346345
InitTracer();
347346
InitMetrics();
348347
InitLogger();
349348

350-
std::cout << "Application payload" << std::endl << std::flush;
349+
std::cout << "Application payload\n" << std::flush;
351350

352351
foo_library();
353352

354353
std::string name{"otlp_http_metric_example"};
355354
foo_library::observable_counter_example(name);
356355

357-
std::cout << "Shutting down opentelemetry-cpp" << std::endl << std::flush;
356+
std::cout << "Shutting down opentelemetry-cpp\n" << std::flush;
358357

359358
CleanupLogger();
360359
CleanupMetrics();
361360
CleanupTracer();
362361

363-
std::cout << "Done" << std::endl << std::flush;
362+
std::cout << "Done\n" << std::flush;
364363
return 0;
365364
}

0 commit comments

Comments
 (0)