Add log::stream_type typedef

This addition is useful when an explicit template instantiation of
operator<< is needed, for example, when logging from an ARM mode
function. Example usage:

template mtl::log::stream_type& mtl::log::stream_type::operator<<
<uint16_t>(uint16_t);

ARM_MODE void foo(int16_t x) {
	mtl::log::debug << x; // Without the explicit template
	instantiation, an ODR violation would occur.
}
This commit is contained in:
Myles Busig 2024-07-28 18:08:21 -06:00
parent 017a88c966
commit e8804cff5b

View File

@ -21,6 +21,8 @@ constexpr char endl_char = 0;
constexpr char endl_char = '\n'; constexpr char endl_char = '\n';
#endif #endif
using stream_type = basic_string_stream<false, endl_char>;
/** /**
* \brief Log stream * \brief Log stream
* *
@ -42,7 +44,7 @@ constexpr char endl_char = '\n';
* On MGBA this also starts the line with "GBA Debug: ",so the line is not * On MGBA this also starts the line with "GBA Debug: ",so the line is not
* completely blank either. * completely blank either.
*/ */
class stream : public basic_string_stream<false, endl_char> { class stream : public stream_type {
private: private:
level m_log_level; level m_log_level;