Merge pull request #11261 from filimonov/kafka_log_with_prefix_and_facility

Add prefix & facility to librdkafka logs
This commit is contained in:
Ilya Yatsishin 2020-05-29 23:02:42 +03:00 committed by GitHub
commit 393db8ff6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -324,10 +324,10 @@ void StorageKafka::updateConfiguration(cppkafka::Configuration & conf)
}
// No need to add any prefix, messages can be distinguished
conf.set_log_callback([this](cppkafka::KafkaHandleBase &, int level, const std::string & /* facility */, const std::string & message)
conf.set_log_callback([this](cppkafka::KafkaHandleBase &, int level, const std::string & facility, const std::string & message)
{
auto [poco_level, client_logs_level] = parseSyslogLevel(level);
LOG_IMPL(log, client_logs_level, poco_level, message);
LOG_IMPL(log, client_logs_level, poco_level, "[rdk:{}] {}", facility, message);
});
// Configure interceptor to change thread name