diff options
author | hop311 <hop3114@gmail.com> | 2024-01-17 23:24:39 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-01-18 23:29:40 +0100 |
commit | e33a330129364b4bd632b2fd531a996b8c57cefb (patch) | |
tree | 88365260addebee9d3ac798d484e02ab18f56692 /src/openvic-simulation/utility/Logger.hpp | |
parent | b5783116f67c9f7aa9d8d9653e6bda0227f67cd2 (diff) |
Parse missing variables, Logger counting, misc cleanup
Diffstat (limited to 'src/openvic-simulation/utility/Logger.hpp')
-rw-r--r-- | src/openvic-simulation/utility/Logger.hpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/openvic-simulation/utility/Logger.hpp b/src/openvic-simulation/utility/Logger.hpp index 20c7fdd..53decb3 100644 --- a/src/openvic-simulation/utility/Logger.hpp +++ b/src/openvic-simulation/utility/Logger.hpp @@ -72,6 +72,7 @@ namespace OpenVic { struct log_channel_t { log_func_t func; log_queue_t queue; + size_t message_count; }; template<typename... Ts> @@ -90,6 +91,8 @@ namespace OpenVic { do { log_channel.func(std::move(log_channel.queue.front())); log_channel.queue.pop(); + /* Only count printed messages, so that message_count matches what is seen in the console. */ + log_channel.message_count++; } while (!log_channel.queue.empty()); } } @@ -103,6 +106,9 @@ public: \ static inline void set_##name##_func(log_func_t log_func) { \ name##_channel.func = log_func; \ } \ + static inline size_t get_##name##_count() { \ + return name##_channel.message_count; \ + } \ template<typename... Ts> \ struct name { \ name(Ts&&... ts, source_location const& location = source_location::current()) { \ |