|
|
@ -161,6 +161,7 @@ void LogPrint (std::stringstream& s, TValue&& arg) noexcept |
|
|
|
s << std::forward<TValue>(arg); |
|
|
|
s << std::forward<TValue>(arg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if (__cplusplus < 201703L) // below C++ 17
|
|
|
|
/** internal usage only -- folding args array to single string */ |
|
|
|
/** internal usage only -- folding args array to single string */ |
|
|
|
template<typename TValue, typename... TArgs> |
|
|
|
template<typename TValue, typename... TArgs> |
|
|
|
void LogPrint (std::stringstream& s, TValue&& arg, TArgs&&... args) noexcept |
|
|
|
void LogPrint (std::stringstream& s, TValue&& arg, TArgs&&... args) noexcept |
|
|
@ -168,6 +169,7 @@ void LogPrint (std::stringstream& s, TValue&& arg, TArgs&&... args) noexcept |
|
|
|
LogPrint (s, std::forward<TValue>(arg)); |
|
|
|
LogPrint (s, std::forward<TValue>(arg)); |
|
|
|
LogPrint (s, std::forward<TArgs>(args)...); |
|
|
|
LogPrint (s, std::forward<TArgs>(args)...); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Create log message and send it to queue |
|
|
|
* @brief Create log message and send it to queue |
|
|
@ -184,7 +186,11 @@ void LogPrint (LogLevel level, TArgs&&... args) noexcept |
|
|
|
// fold message to single string
|
|
|
|
// fold message to single string
|
|
|
|
std::stringstream ss(""); |
|
|
|
std::stringstream ss(""); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if (__cplusplus >= 201703L) // C++ 17 or higher
|
|
|
|
|
|
|
|
(LogPrint (ss, std::forward<TArgs>(args)), ...); |
|
|
|
|
|
|
|
#else |
|
|
|
LogPrint (ss, std::forward<TArgs>(args)...); |
|
|
|
LogPrint (ss, std::forward<TArgs>(args)...); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
auto msg = std::make_shared<i2p::log::LogMsg>(level, std::time(nullptr), ss.str()); |
|
|
|
auto msg = std::make_shared<i2p::log::LogMsg>(level, std::time(nullptr), ss.str()); |
|
|
|
msg->tid = std::this_thread::get_id(); |
|
|
|
msg->tid = std::this_thread::get_id(); |
|
|
|