From 746fdc87b95d8d574db143326cb8a65cc09bace3 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Sat, 1 Aug 2015 09:03:35 -0500 Subject: [PATCH] main: convert error messages to logger Calling the logger 'main' may cause confusion to external readers not familiar with the source code, since there is nothing 'main' about this logger in particular - that is just the file name. It is then called the start up log. Signed-off-by: Glauber Costa --- main.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.cc b/main.cc index 906e68a18a..6d11f0feb1 100644 --- a/main.cc +++ b/main.cc @@ -50,6 +50,9 @@ static void apply_logger_settings(sstring default_level, db::config::string_map logging::logger::set_syslog_enabled(log_to_syslog); } + +logging::logger startlog("start up"); + int main(int ac, char** av) { runtime::init_uptime(); std::setvbuf(stdout, nullptr, _IOLBF, 1000); @@ -121,7 +124,7 @@ int main(int ac, char** av) { try { f.get(); } catch (std::system_error& e) { - fprint(std::cerr, "Directory \"%s\" not found. Tried to created it but failed: %s\n", datadir, e.what()); + startlog.error("Directory '{}' not found. Tried to created it but failed: {}", datadir, e.what()); throw; } }); @@ -132,7 +135,7 @@ int main(int ac, char** av) { try { f.get(); } catch (std::system_error& e) { - fprint(std::cerr, "commitlog directory \"%s\" not found. Tried to created it but failed: %s\n", commitlog, e.what()); + startlog.error("commitlog directory '{}' not found. Tried to created it but failed: {}", commitlog, e.what()); throw; } });