Simple wrapper for output streams that is used to stringify values in assertions and exceptions.
More...
|
| Logger (StreamT &&out) |
| Construct the object with an underlying streaming object. More...
|
|
template<typename ValueT , std::enable_if_t< internal::is_streamable_type< std::ostream, ValueT >, int > = 0> |
Logger< StreamT > & | operator<< (ValueT &&value) |
| Forward all values for which StreamT::operator<< is defined to the underlying streaming object. More...
|
|
StreamT && | stream () |
| Get the underlying streaming object. Flushes all buffered logs to the underlying stream before returning a reference to the stream. More...
|
|
void | flush () |
| Flushes all buffered logs to the underlying stream.
|
|
| ~Logger () |
| Destructor of the logger stream, which flushes all buffered logs to the underlying stream upon destruction.
|
|
template<typename StreamT>
class kassert::Logger< StreamT >
Simple wrapper for output streams that is used to stringify values in assertions and exceptions.
To enable stringification for custom types, overload the <<
operator of this class. The library overloads this operator for the following STL types:
std::vector<T>
std::pair<K, V>
- Template Parameters
-
StreamT | The underlying streaming object (e.g., std::ostream or std::ostringstream ). |
template<typename StreamT >
template<typename ValueT , std::enable_if_t< internal::is_streamable_type< std::ostream, ValueT >, int > = 0>
Forward all values for which StreamT::operator<<
is defined to the underlying streaming object.
- Parameters
-
value | Value to be stringified. |
- Template Parameters
-
ValueT | Type of the value to be stringified. |