streamable object to string function in logging
parent
463e36e48d
commit
ffeab29e5f
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
include(cmake/color.cmake)
|
||||
set(BLT_VERSION 2.0.8)
|
||||
set(BLT_VERSION 2.0.9)
|
||||
|
||||
set(BLT_TARGET BLT)
|
||||
|
||||
|
|
|
@ -262,6 +262,14 @@ namespace blt::logging
|
|||
|
||||
void log_stream_internal(const std::string& str, const logger& logger);
|
||||
|
||||
template<typename T>
|
||||
inline std::string to_string_stream(const T& t)
|
||||
{
|
||||
std::stringstream stream;
|
||||
stream << t;
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline static void log_stream(const T& t, const logger& logger)
|
||||
{
|
||||
|
@ -273,9 +281,7 @@ namespace blt::logging
|
|||
log_stream_internal(t, logger);
|
||||
} else
|
||||
{
|
||||
std::stringstream stream;
|
||||
stream << t;
|
||||
log_stream_internal(stream.str(), logger);
|
||||
log_stream_internal(to_string_stream(t), logger);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,9 +301,7 @@ namespace blt::logging
|
|||
log_internal(std::string(t), level, file, line, args);
|
||||
} else
|
||||
{
|
||||
std::stringstream stream;
|
||||
stream << t;
|
||||
log_internal(stream.str(), level, file, line, args);
|
||||
log_internal(to_string_stream(t), level, file, line, args);
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue