From 2ae150407bb2beb45b2d3155a114992bdb59798e Mon Sep 17 00:00:00 2001 From: zhaohe Date: Wed, 11 Jan 2023 17:26:48 +0800 Subject: [PATCH] update logger.hpp --- core/spdlogfactory/logger.hpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/core/spdlogfactory/logger.hpp b/core/spdlogfactory/logger.hpp index e772f68..9055994 100644 --- a/core/spdlogfactory/logger.hpp +++ b/core/spdlogfactory/logger.hpp @@ -12,15 +12,14 @@ #include #include #include -#include "spdlog/spdlog.h" -#include "iflytopcpp/core/spdlogfactory/logger_factory.hpp" #include "iflytopcpp/core/basic/nlohmann/json.hpp" - - +#include "iflytopcpp/core/spdlogfactory/logger_factory.hpp" #include "spdlog/fmt/ostr.h" +#include "spdlog/spdlog.h" extern "C" { #include + #include "linux/input-event-codes.h" } @@ -61,6 +60,13 @@ ENABLE_BASIC_TYPE_LOGGER(double) // dump input event template static inline OStream &operator<<(OStream &os, struct input_event &event) { - return os << fmt::format("input-event {} {} {}", event.type, event.code, - event.value); + return os << fmt::format("input-event {} {} {}", event.type, event.code, event.value); } + +#define ZCHECK(exptr, info) \ + { \ + if (!(exptr)) { \ + logger->critical("({}:{})ZCHECK failed: {} {}", __FILE__, __LINE__, info, #exptr); \ + exit(-1); \ + } \ + }