aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/utility/Logger.hpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-01-18 23:52:14 +0100
committer GitHub <noreply@github.com>2024-01-18 23:52:14 +0100
commitc1bac9acee88a7ce1123aed3a748712fb2441762 (patch)
tree346cd26d4a74c92cb78c674242703283895aa5f4 /src/openvic-simulation/utility/Logger.hpp
parent75878b11821d8fd78ebdd7b0a11a82970a531616 (diff)
parente33a330129364b4bd632b2fd531a996b8c57cefb (diff)
Merge pull request #131 from OpenVicProject/misc-changes
Parse missing variables, Logger counting, misc cleanup
Diffstat (limited to 'src/openvic-simulation/utility/Logger.hpp')
-rw-r--r--src/openvic-simulation/utility/Logger.hpp6
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()) { \