aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/utility/Logger.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-10-15 16:26:39 +0200
committer GitHub <noreply@github.com>2023-10-15 16:26:39 +0200
commit3249e21104bab6002676abe00450e7bd3f682303 (patch)
treec2a13a44d4c8553f6e87193f5f437052cf1d7067 /src/openvic-simulation/utility/Logger.cpp
parent17847e16e14ec52eb48a6fd0d9dc36ee93e457db (diff)
parentd26f9c2fb5a9666822a0f702d76b764600a390d7 (diff)
Merge pull request #52 from OpenVicProject/tgc-compat
TGC compatibility fixes + other cleanup
Diffstat (limited to 'src/openvic-simulation/utility/Logger.cpp')
-rw-r--r--src/openvic-simulation/utility/Logger.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/openvic-simulation/utility/Logger.cpp b/src/openvic-simulation/utility/Logger.cpp
index fca08a5..68c43dd 100644
--- a/src/openvic-simulation/utility/Logger.cpp
+++ b/src/openvic-simulation/utility/Logger.cpp
@@ -4,19 +4,19 @@
using namespace OpenVic;
-Logger::log_func_t Logger::info_func {};
-Logger::log_queue_t Logger::info_queue {};
-Logger::log_func_t Logger::warning_func {};
-Logger::log_queue_t Logger::warning_queue {};
-Logger::log_func_t Logger::error_func {};
-Logger::log_queue_t Logger::error_queue {};
+void Logger::set_logger_funcs() {
+ Logger::set_info_func([](std::string&& str) { std::cout << str; });
+ Logger::set_warning_func([](std::string&& str) { std::cerr << str; });
+ Logger::set_error_func([](std::string&& str) { std::cerr << str; });
+}
-char const* Logger::get_filename(char const* filepath) {
- if (filepath == nullptr) return nullptr;
+char const* Logger::get_filename(char const* filepath, char const* default_path) {
+ if (filepath == nullptr) return default_path;
char const* last_slash = filepath;
while (*filepath != '\0') {
if (*filepath == '\\' || *filepath == '/') last_slash = filepath + 1;
filepath++;
}
+ if (*last_slash == '\0') return default_path;
return last_slash;
}