From 5202e741b3d7c22e3a0e80a06bb90e58288c7778 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sat, 25 May 2024 22:41:50 -0400 Subject: [PATCH] Templatize log span on duration type. --- include/bitcoin/network/log/logger.hpp | 10 ++++++++-- include/bitcoin/network/log/reporter.hpp | 7 ++++++- src/log/logger.cpp | 6 ------ src/log/reporter.cpp | 5 ----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/bitcoin/network/log/logger.hpp b/include/bitcoin/network/log/logger.hpp index 8f91054a1..e63f9ab16 100644 --- a/include/bitcoin/network/log/logger.hpp +++ b/include/bitcoin/network/log/logger.hpp @@ -20,6 +20,7 @@ #define LIBBITCOIN_NETWORK_LOG_LOGGER_HPP #include +#include #include #include #include @@ -103,8 +104,13 @@ class BCT_API logger final /// Fire event with optional value, recorded with current time. void fire(uint8_t event_, uint64_t value=zero) const NOEXCEPT; - /// Fire event with nanosecond duration value, recorded with current time. - void span(uint8_t event_, const time& started) const NOEXCEPT; + /// Fire event with value as duration start to now, in specified unints. + template + inline void span(uint8_t event_, const time& start) const NOEXCEPT + { + // value parameter is time span in Time units. + fire(event_, std::chrono::duration_cast