16
16
#include < userver/yaml_config/yaml_config.hpp>
17
17
18
18
#include < kafka/impl/error_buffer.hpp>
19
- #include < kafka/impl/log_level.hpp>
20
19
21
20
USERVER_NAMESPACE_BEGIN
22
21
23
22
namespace kafka ::impl {
24
23
25
24
namespace {
26
25
27
- // / @brief Redirect `librdkafka` logs to `userver` logs.
28
- // /
29
- // / @see
30
- // / https://docs.confluent.io/platform/current/clients/librdkafka/html/rdkafka_8h.html#a06ade2ca41f32eb82c6f7e3d4acbe19f
31
- void KafkaLogCallback ([[maybe_unused]] const rd_kafka_t *, int level, const char * fac, const char * buf) noexcept {
32
- LOG (userver::kafka::impl::convertRdKafkaLogLevelToLoggingLevel (level)) << fac << buf;
33
- }
34
-
35
26
template <class SupportedList >
36
27
bool IsSupportedOption (const SupportedList& supported_options, const std::string& configured_option) {
37
28
return utils::ContainsIf (supported_options, [&configured_option](std::string_view supported_option) {
@@ -54,8 +45,8 @@ void VerifyComponentNamePrefix(const std::string& component_name, const std::str
54
45
// producer's component should start with kafka-producer, consumer's - with
55
46
// kafka-consumer
56
47
if (component_name.rfind (expected_prefix) != 0 ) {
57
- throw std::runtime_error{
58
- fmt::format ( " Component '{}' doesn't start with '{}' " , component_name, expected_prefix) };
48
+ throw std::runtime_error{fmt::format ( " Component '{}' doesn't start with '{}' " , component_name, expected_prefix)
49
+ };
59
50
}
60
51
}
61
52
@@ -122,7 +113,8 @@ SecurityConfiguration Parse(const yaml_config::YamlConfig& config, formats::pars
122
113
123
114
security.security_protocol .emplace <SecurityConfiguration::SaslSsl>(SecurityConfiguration::SaslSsl{
124
115
/* security_mechanism=*/ mechanism,
125
- /* ssl_ca_location=*/ config[" ssl_ca_location" ].As <std::string>()});
116
+ /* ssl_ca_location=*/ config[" ssl_ca_location" ].As <std::string>()
117
+ });
126
118
}
127
119
128
120
return security;
@@ -291,8 +283,6 @@ void Configuration::SetOption(const char* option, const char* value, T to_print)
291
283
#pragma GCC diagnostic pop
292
284
#endif
293
285
if (err == RD_KAFKA_CONF_OK) {
294
- rd_kafka_conf_set_log_cb (conf_.GetHandle (), KafkaLogCallback);
295
-
296
286
LOG_INFO () << fmt::format (" Kafka conf option: '{}' -> '{}'" , option, to_print);
297
287
return ;
298
288
}
0 commit comments