13 #ifndef TLX_LOGGER_CORE_HEADER 14 #define TLX_LOGGER_CORE_HEADER 24 template <
typename AnyType,
typename Enable =
void>
89 template <
typename AnyType>
117 template <
typename AnyType>
119 if (!first_) oss_ <<
' ';
137 #define TLX_LOGC(cond) \ 138 !(cond) ? (void)0 : ::tlx::LoggerVoidify() & ::tlx::Logger() 141 #define TLX_LOG TLX_LOGC(debug) 144 #define TLX_LOG0 TLX_LOGC(false) 145 #define TLX_LOG1 TLX_LOGC(true) 148 #define TLX_sLOGC(cond) \ 149 !(cond) ? (void)0 : ::tlx::LoggerVoidify() & ::tlx::SpacingLogger() 152 #define TLX_sLOG TLX_sLOGC(debug) 155 #define TLX_sLOG0 TLX_sLOGC(false) 156 #define TLX_sLOG1 TLX_sLOGC(true) 169 virtual void add_log_prefix(std::ostream& os) = 0;
187 virtual void append_log_line(
const std::string& line) = 0;
214 void append_log_line(
const std::string& line)
final;
230 template <
typename AnyType>
234 static void print(std::ostream& os,
const AnyType& t) {
239 template <
typename A,
typename B>
243 static void print(std::ostream& os,
const std::pair<A, B>& p) {
252 template <
typename T,
class A>
256 static void print(std::ostream& os,
const std::vector<T, A>& data) {
258 for (
typename std::vector<T>::const_iterator it = data.begin();
259 it != data.end(); ++it)
261 if (it != data.begin()) os <<
',';
270 #endif // !TLX_LOGGER_CORE_HEADER LOG and sLOG for development and debugging.
A logging class which outputs spaces between elements pushed via operator<<.
LoggerOutputHook * set_logger_output_hook(LoggerOutputHook *hook)
LoggerOutputHook * next_
previous logger, will be restored by destructor
Class to hook logger output in the local thread.
std::ostringstream oss_
collector stream
Abstract class to implement output hooks for logging.
bool echo_
whether to echo each line to next logger output
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
std::vector< T, Allocator< T > > vector
vector with Manager tracking
Abstract class to implement prefix output hooks for logging.
~Logger()
destructor: output a newline
LoggerOutputHook * set_logger_to_stderr()
std::ostringstream oss_
collector stream
LoggerPrefixHook * set_logger_prefix_hook(LoggerPrefixHook *hook)
std::ostringstream oss_
string stream collecting
Logger & operator<<(const AnyType &at)
output any type, including io manipulators
Logger()
construction: add prefix if desired