aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/utility/Logger.hpp
diff options
context:
space:
mode:
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()) { \