diff --git a/config.cpp b/config.cpp index 9d0693d..e5ef3a4 100644 --- a/config.cpp +++ b/config.cpp @@ -25,7 +25,7 @@ static void fclose_and_log(FILE* file) { return; } std::system_error e = std::system_error(errno, std::generic_category(), "fclose()"); - log("Failed to close a file", std::move(e)); + log(std::string("Failed to close a file: ") + e.what()); } static bool write(const std::string& ptr, FILE* file) { diff --git a/event_loop.cpp b/event_loop.cpp index aa4d968..bcd89a1 100644 --- a/event_loop.cpp +++ b/event_loop.cpp @@ -8,7 +8,7 @@ static inline void write_config_and_update_structures(const Config& config) { try { write_config(config); } catch (const std::exception& e) { - log("Failed to write config", e); + log(std::string("Failed to write config: ") + e.what()); return; } } diff --git a/log.cpp b/log.cpp index 7da6e4a..f3b872c 100644 --- a/log.cpp +++ b/log.cpp @@ -29,11 +29,3 @@ void log(std::string entry, time_t time) { void log(std::string entry) { log(std::move(entry), time(nullptr)); } - -void log(std::string action, const std::exception& e, time_t time) { - log(action + ": " + e.what(), time); -} - -void log(std::string action, const std::exception& e) { - log(std::move(action), e, time(nullptr)); -} diff --git a/log.h b/log.h index 3d70c78..00c5d2a 100644 --- a/log.h +++ b/log.h @@ -8,5 +8,3 @@ extern std::string log_entries; void log(std::string entry, time_t time); void log(std::string entry); -void log(std::string action, const std::exception& e, time_t time); -void log(std::string action, const std::exception& e); diff --git a/main.cpp b/main.cpp index 35f4a92..6b2ec33 100644 --- a/main.cpp +++ b/main.cpp @@ -117,7 +117,7 @@ int main(int, char**) { io.Fonts->AddFontFromFileTTF(fonts.first.c_str(), config.normal_font_size); monospace_font = io.Fonts->AddFontFromFileTTF(fonts.second.c_str(), config.monospace_font_size); } catch (const std::exception& e) { - log("Failed to get fonts", e); + log(std::string("Failed to get fonts: ") + e.what()); } #endif if (!monospace_font) {