aboutsummaryrefslogtreecommitdiff
path: root/include/hotstuff/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/hotstuff/util.h')
-rw-r--r--include/hotstuff/util.h18
1 files changed, 18 insertions, 0 deletions
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