Skip to content
Snippets Groups Projects

Resolve "Upgrade logging library"

Merged Mateus Sanches Moura requested to merge 491-upgrade-logging-library into devel
@@ -34,8 +34,10 @@
@@ -34,8 +34,10 @@
// spdlog include
// spdlog include
#include "spdlog/spdlog.h"
#include "spdlog/spdlog.h"
 
#include "spdlog/async.h"
// enable the use of ostream operator<<
// enable the use of ostream operator<<
#include "spdlog/fmt/bundled/ostream.h"
#include "spdlog/fmt/ostr.h"
 
#include "spdlog/sinks/stdout_color_sinks.h"
// Wolf includes
// Wolf includes
#include "core/utils/singleton.h"
#include "core/utils/singleton.h"
@@ -125,7 +127,11 @@ inline Logger::Logger(const std::string& name) :
@@ -125,7 +127,11 @@ inline Logger::Logger(const std::string& name) :
// Enable asynchronous logging
// Enable asynchronous logging
// Queue size must be a power of 2
// Queue size must be a power of 2
 
#if SPDLOG_VER_MAJOR >= 1
 
spdlog::init_thread_pool(4096, 1);
 
#else
spdlog::set_async_mode(4096);
spdlog::set_async_mode(4096);
 
#endif
if (log_name_ == __INTERNAL_WOLF_MAIN_LOGGER_NAME_)
if (log_name_ == __INTERNAL_WOLF_MAIN_LOGGER_NAME_)
// Logging pattern is :
// Logging pattern is :
@@ -154,7 +160,11 @@ inline Logger::Logger(std::string&& name) :
@@ -154,7 +160,11 @@ inline Logger::Logger(std::string&& name) :
// Enable asynchronous logging
// Enable asynchronous logging
// Queue size must be a power of 2
// Queue size must be a power of 2
 
#if SPDLOG_VER_MAJOR >= 1
 
spdlog::init_thread_pool(4096, 1);
 
#else
spdlog::set_async_mode(4096);
spdlog::set_async_mode(4096);
 
#endif
if (log_name_ == __INTERNAL_WOLF_MAIN_LOGGER_NAME_)
if (log_name_ == __INTERNAL_WOLF_MAIN_LOGGER_NAME_)
// Logging pattern is :
// Logging pattern is :
@@ -209,8 +219,11 @@ void Logger::trace(Args&&... args) const
@@ -209,8 +219,11 @@ void Logger::trace(Args&&... args) const
inline bool Logger::set_async_queue(const std::size_t q_size)
inline bool Logger::set_async_queue(const std::size_t q_size)
{
{
bool p2 = q_size%2 == 0;
bool p2 = q_size%2 == 0;
#if SPDLOG_VER_MAJOR >= 1
 
if (p2) spdlog::init_thread_pool(q_size, 1);
 
#else
if (p2) spdlog::set_async_mode(q_size);
if (p2) spdlog::set_async_mode(q_size);
 
#endif
return q_size;
return q_size;
}
}
Loading