17#ifndef IOX_HOOFS_LOG_LOGSTREAM_HPP
18#define IOX_HOOFS_LOG_LOGSTREAM_HPP
20#include "iceoryx_hoofs/cxx/convert.hpp"
21#include "iceoryx_hoofs/log/logcommon.hpp"
41 constexpr LogHex8(uint8_t value) noexcept
50 constexpr LogHex16(uint16_t value) noexcept
58 constexpr LogHex32(uint32_t value) noexcept
66 constexpr LogHex64(uint64_t value) noexcept
80 constexpr LogBin8(uint8_t value) noexcept
88 constexpr LogBin16(uint16_t value) noexcept
96 constexpr LogBin32(uint32_t value) noexcept
104 constexpr LogBin64(uint64_t value) noexcept
120 LogStream(
Logger& logger, LogLevel logLevel = LogLevel::kWarn)
noexcept;
124 void Flush()
noexcept;
126 LogStream& operator<<(
const char* cstr)
noexcept;
128 LogStream& operator<<(
const std::string& str)
noexcept;
130 template <typename T, typename std::enable_if<std::is_arithmetic<T>::value,
int>::type = 0>
131 LogStream& operator<<(
const T val)
noexcept
138 template <typename T, typename std::enable_if<std::is_base_of<LogHex, T>::value,
int>::type = 0>
139 LogStream& operator<<(
const T val)
noexcept
141 std::stringstream ss;
143 ss <<
"0x" << std::hex << +val.value;
144 m_logEntry.message.append(ss.str());
149 template <typename T, typename std::enable_if<std::is_base_of<LogBin, T>::value,
int>::type = 0>
150 LogStream& operator<<(
const T val)
noexcept
152 m_logEntry.message.append(
"0b");
153 m_logEntry.message.append(std::bitset<std::numeric_limits<
decltype(val.value)>::digits>(val.value).to_string());
162 bool m_flushed{
false};
static std::enable_if<!std::is_convertible< Source, std::string >::value, std::string >::type toString(const Source &t) noexcept
Converts every type which is either a pod (plain old data) type or is convertable to a string (this m...
Definition: logstream.hpp:118
Definition: logger.hpp:37
building block to easily create free function for logging in a library context
Definition: lockfree_queue.hpp:29
std::ostream & operator<<(std::ostream &stream, Error value) noexcept
Convenience stream operator to easily use the Error enum with std::ostream.
Definition: logstream.hpp:86
Definition: logstream.hpp:94
Definition: logstream.hpp:102
Definition: logstream.hpp:78
Definition: logstream.hpp:74
Definition: logcommon.hpp:71
Definition: logstream.hpp:48
Definition: logstream.hpp:56
Definition: logstream.hpp:64
Definition: logstream.hpp:39
Definition: logstream.hpp:35
Definition: logstream.hpp:110