diff --git a/libs/libcommon/include/common/logger_useful.h b/libs/libcommon/include/common/logger_useful.h index 88a65563b2a..84c672b2c6c 100644 --- a/libs/libcommon/include/common/logger_useful.h +++ b/libs/libcommon/include/common/logger_useful.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -22,38 +23,6 @@ using DB::CurrentThread; #if defined(POCO_CLICKHOUSE_PATCH) -#define LOG_TRACE(logger, message) do { \ - if ((logger)->trace()) {\ - std::stringstream oss_internal_rare; \ - oss_internal_rare << message; \ - (logger)->trace(oss_internal_rare.str());}} while(false) - -#define LOG_DEBUG(logger, message) do { \ - if ((logger)->debug()) {\ - std::stringstream oss_internal_rare; \ - oss_internal_rare << message; \ - (logger)->debug(oss_internal_rare.str());}} while(false) - -#define LOG_INFO(logger, message) do { \ - if ((logger)->information()) {\ - std::stringstream oss_internal_rare; \ - oss_internal_rare << message; \ - (logger)->information(oss_internal_rare.str());}} while(false) - -#define LOG_WARNING(logger, message) do { \ - if ((logger)->warning()) {\ - std::stringstream oss_internal_rare; \ - oss_internal_rare << message; \ - (logger)->warning(oss_internal_rare.str());}} while(false) - -#define LOG_ERROR(logger, message) do { \ - if ((logger)->error()) {\ - std::stringstream oss_internal_rare; \ - oss_internal_rare << message; \ - (logger)->error(oss_internal_rare.str());}} while(false) - -#else - #define LOG_TRACE(logger, message) do { \ const bool is_clients_log = (CurrentThread::getGroup() != nullptr) && (CurrentThread::getGroup()->client_logs_level >= LogsLevel::trace); \ if ((logger)->trace() || is_clients_log) {\ @@ -109,5 +78,37 @@ using DB::CurrentThread; (logger)->error(oss_internal_rare.str()); \ }}} while(false) +#else + +#define LOG_TRACE(logger, message) do { \ + if ((logger)->trace()) {\ + std::stringstream oss_internal_rare; \ + oss_internal_rare << message; \ + (logger)->trace(oss_internal_rare.str());}} while(false) + +#define LOG_DEBUG(logger, message) do { \ + if ((logger)->debug()) {\ + std::stringstream oss_internal_rare; \ + oss_internal_rare << message; \ + (logger)->debug(oss_internal_rare.str());}} while(false) + +#define LOG_INFO(logger, message) do { \ + if ((logger)->information()) {\ + std::stringstream oss_internal_rare; \ + oss_internal_rare << message; \ + (logger)->information(oss_internal_rare.str());}} while(false) + +#define LOG_WARNING(logger, message) do { \ + if ((logger)->warning()) {\ + std::stringstream oss_internal_rare; \ + oss_internal_rare << message; \ + (logger)->warning(oss_internal_rare.str());}} while(false) + +#define LOG_ERROR(logger, message) do { \ + if ((logger)->error()) {\ + std::stringstream oss_internal_rare; \ + oss_internal_rare << message; \ + (logger)->error(oss_internal_rare.str());}} while(false) + #endif