From e41eef9d19fe3a3ab9b158c985b180a3f76f93f7 Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 7 Aug 2018 20:41:53 -0400 Subject: fix bugs --- include/hotstuff/util.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/hotstuff/util.h') diff --git a/include/hotstuff/util.h b/include/hotstuff/util.h index 99b5ea4..25dda70 100644 --- a/include/hotstuff/util.h +++ b/include/hotstuff/util.h @@ -9,13 +9,25 @@ namespace hotstuff { class Logger: public salticidae::Logger { public: using salticidae::Logger::Logger; + + void proto(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + write("proto", fmt, ap); + va_end(ap); + } }; extern Logger logger; +#ifdef HOTSTUFF_PROTO_LOG +#define HOTSTUFF_ENABLE_LOG_PROTO +#endif + #ifdef HOTSTUFF_DEBUG_LOG #define HOTSTUFF_NORMAL_LOG #define HOTSTUFF_ENABLE_LOG_DEBUG +#define HOTSTUFF_ENABLE_LOG_PROTO #endif #ifdef HOTSTUFF_NORMAL_LOG @@ -41,6 +53,12 @@ extern Logger logger; #define HOTSTUFF_LOG_WARN(...) ((void)0) #endif +#ifdef HOTSTUFF_ENABLE_LOG_PROTO +#define HOTSTUFF_LOG_PROTO(...) hotstuff::logger.proto(__VA_ARGS__) +#else +#define HOTSTUFF_LOG_PROTO(...) ((void)0) +#endif + #define HOTSTUFF_LOG_ERROR(...) hotstuff::logger.error(__VA_ARGS__) #ifdef HOTSTUFF_BLK_PROFILE -- cgit v1.2.3