init: init_ms_fd_gossiper: use logger for error message

Currently fmt::print is used to print an error message
if (broadcast_address != listen && seeds.count(listen))
and the logger should be used instead.

While at it, the information printed in this message is valueable
also in the error-free case, so this change logs it at `info`
level and then logs an error without repeating the said info.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>

Test: bootstrap_test.py:TestBootstrap.start_stop_test_node(dev)
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20200630083826.153326-1-bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2020-06-30 11:38:26 +03:00
committed by Avi Kivity
parent 5125e9b51d
commit 7dc3ce4994

View File

@@ -139,9 +139,10 @@ void init_ms_fd_gossiper(sharded<gms::gossiper>& gossiper
seeds.emplace(gms::inet_address("127.0.0.1"));
}
auto broadcast_address = utils::fb_utilities::get_broadcast_address();
startlog.info("seeds={}, listen_address={}, broadcast_address={}",
to_string(seeds), listen_address_in, broadcast_address);
if (broadcast_address != listen && seeds.count(listen)) {
fmt::print("Use broadcast_address instead of listen_address for seeds list: seeds={}, listen_address={}, broadcast_address={}\n",
to_string(seeds), listen_address_in, broadcast_address);
startlog.error("Use broadcast_address instead of listen_address for seeds list");
throw std::runtime_error("Use broadcast_address for seeds list");
}
if ((!cfg.replace_address_first_boot().empty() || !cfg.replace_address().empty()) && seeds.count(broadcast_address)) {