locator::gossiping_property_file_snitch: get rid of warn() and err() wrappers
Use logger() accessor instead for a better resemblance with the Origin. Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
This commit is contained in:
@@ -57,8 +57,7 @@ future<bool> gossiping_property_file_snitch::property_file_was_modified() {
|
||||
return false;
|
||||
}
|
||||
} catch (...) {
|
||||
this->err("Failed to open {} for read or to get stats",
|
||||
_fname);
|
||||
logger().error("Failed to open {} for read or to get stats", _fname);
|
||||
throw;
|
||||
}
|
||||
});
|
||||
@@ -111,8 +110,7 @@ void gossiping_property_file_snitch::periodic_reader_callback() {
|
||||
try {
|
||||
f.get();
|
||||
} catch (...) {
|
||||
this->err("Exception has been thrown when parsing the property "
|
||||
"file.");
|
||||
logger().error("Exception has been thrown when parsing the property file.");
|
||||
}
|
||||
|
||||
if (_state == snitch_state::stopping || _state == snitch_state::io_pausing) {
|
||||
@@ -168,11 +166,10 @@ future<> gossiping_property_file_snitch::read_property_file() {
|
||||
// - Print an error when reloading.
|
||||
//
|
||||
if (_state == snitch_state::initializing) {
|
||||
this->err("Failed to parse a properties file ({}). "
|
||||
"Halting...", _fname);
|
||||
logger().error("Failed to parse a properties file ({}). Halting...", _fname);
|
||||
throw;
|
||||
} else {
|
||||
this->warn("Failed to reload a properties file ({}). "
|
||||
logger().warn("Failed to reload a properties file ({}). "
|
||||
"Using previous values.", _fname);
|
||||
return make_ready_future<>();
|
||||
}
|
||||
|
||||
@@ -83,33 +83,18 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static logging::logger& logger() {
|
||||
return i_endpoint_snitch::snitch_logger;
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void err(const char* fmt, Args&&... args) const {
|
||||
logger().error(fmt, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void warn(const char* fmt, Args&&... args) const {
|
||||
logger().warn(fmt, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
void throw_double_declaration(const sstring& key) const {
|
||||
err("double \"{}\" declaration in {}", key, _fname);
|
||||
logger().error("double \"{}\" declaration in {}", key, _fname);
|
||||
throw bad_property_file_error();
|
||||
}
|
||||
|
||||
void throw_bad_format(const sstring& line) const {
|
||||
err("Bad format in properties file {}: {}", _fname, line);
|
||||
logger().error("Bad format in properties file {}: {}", _fname, line);
|
||||
throw bad_property_file_error();
|
||||
}
|
||||
|
||||
void throw_incomplete_file() const {
|
||||
err("Property file {} is incomplete. Both \"dc\" and \"rack\" "
|
||||
"labels have to be defined.", _fname);
|
||||
logger().error("Property file {} is incomplete. Both \"dc\" and \"rack\" labels have to be defined.", _fname);
|
||||
throw bad_property_file_error();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,6 @@
|
||||
|
||||
namespace locator {
|
||||
|
||||
logging::logger i_endpoint_snitch::snitch_logger("snitch_logger");
|
||||
|
||||
std::vector<inet_address> snitch_base::get_sorted_list_by_proximity(
|
||||
inet_address address,
|
||||
std::unordered_set<inet_address>& unsorted_address) {
|
||||
|
||||
@@ -165,14 +165,17 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
static logging::logger& logger() {
|
||||
static logging::logger snitch_logger("snitch_logger");
|
||||
return snitch_logger;
|
||||
}
|
||||
|
||||
static unsigned& io_cpu_id() {
|
||||
static unsigned id = 0;
|
||||
return id;
|
||||
}
|
||||
|
||||
protected:
|
||||
static logging::logger snitch_logger;
|
||||
|
||||
enum class snitch_state {
|
||||
initializing,
|
||||
running,
|
||||
@@ -254,7 +257,7 @@ future<> i_endpoint_snitch::init_snitch_obj(
|
||||
s->set_my_distributed(&snitch_obj);
|
||||
local_inst = std::move(s);
|
||||
} catch (no_such_class& e) {
|
||||
snitch_logger.error("Can't create snitch {}: not supported", snitch_name);
|
||||
logger().error("Can't create snitch {}: not supported", snitch_name);
|
||||
throw;
|
||||
} catch (...) {
|
||||
throw;
|
||||
|
||||
Reference in New Issue
Block a user