Commit 9ff0a986a9351bc517a6303d2b25d8ed7f0b548b

Authored by Patric Stout
1 parent 76c8620c

fix: compiling with DEBUG or TRACE level fails

Showing 1 changed file with 4 additions and 3 deletions
src/Client.cpp
... ... @@ -11,6 +11,7 @@
11 11 #include "Connection.h"
12 12 #include "Log.h"
13 13  
  14 +#include <magic_enum.hpp>
14 15 #include <sstream>
15 16  
16 17 TrueMQTT::Client::Client(const std::string_view host,
... ... @@ -54,12 +55,12 @@ TrueMQTT::Client::Impl::~Impl() = default;
54 55  
55 56 void TrueMQTT::Client::setLogger(Client::LogLevel log_level, const std::function<void(Client::LogLevel, std::string_view)> &logger) const
56 57 {
57   - LOG_TRACE(m_impl, "Setting logger to log level " + std::to_string(log_level));
  58 + LOG_TRACE(m_impl, "Setting logger to log level " + std::string(magic_enum::enum_name(log_level)));
58 59  
59 60 m_impl->m_log_level = log_level;
60 61 m_impl->m_logger = logger;
61 62  
62   - LOG_DEBUG(m_impl, "Log level now on " + std::to_string(m_impl->m_log_level));
  63 + LOG_DEBUG(m_impl, "Log level now on " + std::string(magic_enum::enum_name(m_impl->m_log_level)));
63 64 }
64 65  
65 66 void TrueMQTT::Client::setLastWill(const std::string_view topic, const std::string_view message, bool retain) const
... ... @@ -92,7 +93,7 @@ void TrueMQTT::Client::setPublishQueue(Client::PublishQueueType queue_type, size
92 93 return;
93 94 }
94 95  
95   - LOG_TRACE(m_impl, "Setting publish queue to type " + std::to_string(queue_type) + " and size " + std::to_string(size));
  96 + LOG_TRACE(m_impl, "Setting publish queue to type " + std::string(magic_enum::enum_name(queue_type)) + " and size " + std::to_string(size));
96 97  
97 98 m_impl->m_publish_queue_type = queue_type;
98 99 m_impl->m_publish_queue_size = size;
... ...