28 #ifndef TOMOGRAPHER_TOOLS_LOGGERS_H 29 #define TOMOGRAPHER_TOOLS_LOGGERS_H 38 #include <type_traits> 41 #include <boost/algorithm/string.hpp> 58 #error "The macro ERROR is defined. You may be on a Windows system. Make sure that <tomographer/tools/logger.h> is included BEFORE any windows-related header." 170 inline int level()
const {
return _level; }
173 inline operator int()
const {
return _level; }
206 if (s ==
"LONGDEBUG") {
208 }
else if (s ==
"DEBUG") {
210 }
else if (s ==
"INFO") {
212 }
else if (s ==
"WARNING") {
214 }
else if (s ==
"ERROR") {
250 return (level <= baselevel);
260 template<
int Level,
int BaseLevel>
263 value = (Level <= BaseLevel)
337 HasFilterByOrigin = 0
350 template<
typename LoggerType>
358 namespace tomo_internal {
362 template<
bool hasOwnGetLevel>
368 LoggerRuntimeLevel(
int level)
373 inline int level()
const 379 inline void setLogLevel(
int level)
391 class TOMOGRAPHER_EXPORT LoggerRuntimeLevel<true>
394 LoggerRuntimeLevel(
int )
398 inline void setLogLevel(
int) {
399 tomographer_assert(0 &&
"Call to LoggerRuntimeLevel::setLogLevel() for Logger which defines HasOwnGetLevel=1!");
404 template<
typename Fn>
405 struct IsOstreamArgCallable
443 template<
typename Derived>
445 #ifndef TOMOGRAPHER_PARSED_BY_DOXYGEN
446 :
public tomo_internal::LoggerRuntimeLevel<LoggerTraits<Derived>::HasOwnGetLevel>
473 : tomo_internal::LoggerRuntimeLevel<HasOwnGetLevel>(level_)
503 StaticMinimumSeverityLevel
519 return staticallyEnabledFor(level_) &&
523 #ifdef TOMOGRAPHER_PARSED_BY_DOXYGEN 554 TOMOGRAPHER_ENABLED_IF(staticallyEnabledFor<ERROR>())
556 inline void error(
const char * origin,
const char * fmt, ...)
560 log<ERROR>(origin, fmt, ap);
571 TOMOGRAPHER_ENABLED_IF(staticallyEnabledFor<ERROR>())
572 inline
void error(const
char * origin,
std::
string msg)
583 template<
typename Fn,
584 TOMOGRAPHER_ENABLED_IF_TMPL(staticallyEnabledFor<ERROR>() &&
586 inline void error(
const char * origin, Fn && f)
588 log<ERROR>(origin, std::forward<Fn>(f));
592 template<TOMOGRAPHER_ENABLED_IF_TMPL(!staticallyEnabledFor<ERROR>()),
typename... Args>
602 TOMOGRAPHER_ENABLED_IF(staticallyEnabledFor<WARNING>())
604 inline void warning(
const char * origin,
const char * fmt, ...)
608 log<WARNING>(origin, fmt, ap);
619 TOMOGRAPHER_ENABLED_IF(staticallyEnabledFor<WARNING>())
620 inline
void warning(const
char * origin,
std::
string msg)
631 template<
typename Fn,
632 TOMOGRAPHER_ENABLED_IF_TMPL(staticallyEnabledFor<WARNING>() &&
634 inline void warning(
const char * origin, Fn && f)
636 log<WARNING>(origin, std::forward<Fn>(f));
640 template<TOMOGRAPHER_ENABLED_IF_TMPL(!staticallyEnabledFor<WARNING>()),
typename... Args>
650 TOMOGRAPHER_ENABLED_IF(staticallyEnabledFor<INFO>())
652 inline void info(
const char * origin,
const char * fmt, ...)
656 log<INFO>(origin, fmt, ap);
667 TOMOGRAPHER_ENABLED_IF(staticallyEnabledFor<INFO>())
668 inline
void info(const
char * origin,
std::
string msg)
678 template<
typename Fn,
679 TOMOGRAPHER_ENABLED_IF_TMPL(staticallyEnabledFor<INFO>() &&
681 inline void info(
const char * origin, Fn && f)
683 log<INFO>(origin, std::forward<Fn>(f));
687 template<TOMOGRAPHER_ENABLED_IF_TMPL(!staticallyEnabledFor<INFO>()),
typename... Args>
688 inline void info(Args && ... ) { }
708 TOMOGRAPHER_ENABLED_IF(staticallyEnabledFor<DEBUG>())
710 inline void debug(
const char * origin,
const char * fmt, ...)
714 log<DEBUG>(origin, fmt, ap);
734 TOMOGRAPHER_ENABLED_IF(staticallyEnabledFor<DEBUG>())
735 inline
void debug(const
char * origin,
std::
string msg)
768 template<
typename Fn,
769 TOMOGRAPHER_ENABLED_IF_TMPL(staticallyEnabledFor<DEBUG>() &&
771 inline void debug(
const char * origin, Fn && f)
773 log<DEBUG>(origin, std::forward<Fn>(f));
777 template<TOMOGRAPHER_ENABLED_IF_TMPL(!staticallyEnabledFor<DEBUG>()),
typename... Args>
787 TOMOGRAPHER_ENABLED_IF(staticallyEnabledFor<LONGDEBUG>())
789 inline void longdebug(
const char * origin,
const char * fmt, ...)
793 log<LONGDEBUG>(origin, fmt, ap);
804 TOMOGRAPHER_ENABLED_IF(staticallyEnabledFor<LONGDEBUG>())
805 inline
void longdebug(const
char * origin,
std::
string msg)
815 template<
typename Fn,
816 TOMOGRAPHER_ENABLED_IF_TMPL(staticallyEnabledFor<LONGDEBUG>() &&
820 log<LONGDEBUG>(origin, std::forward<Fn>(f));
824 template<TOMOGRAPHER_ENABLED_IF_TMPL(!staticallyEnabledFor<LONGDEBUG>()),
typename... Args>
838 inline void log(
int level,
const char * origin,
const char * fmt, ...)
842 _do_log(level, origin, fmt, ap);
870 inline void log(
int level,
const char * origin, Fn && f)
872 _do_log(level, origin, std::forward<Fn>(f));
884 template<
int Level, TOMOGRAPHER_ENABLED_IF_TMPL(staticallyEnabledFor<Level>())>
886 inline void log(
const char * origin,
const char * fmt, ...)
890 _do_log(Level, origin, fmt, ap);
903 template<
int Level, TOMOGRAPHER_ENABLED_IF_TMPL(staticallyEnabledFor<Level>())>
904 inline void log(
const char * origin,
const char * fmt,
va_list ap)
906 _do_log(Level, origin, fmt, ap);
917 template<
int Level, TOMOGRAPHER_ENABLED_IF_TMPL(staticallyEnabledFor<Level>())>
931 template<
int Level,
typename Fn,
932 TOMOGRAPHER_ENABLED_IF_TMPL(staticallyEnabledFor<Level>() &&
934 inline void log(
const char * origin, Fn f)
936 _do_log(Level, origin, f);
940 template<
int Level, TOMOGRAPHER_ENABLED_IF_TMPL(!staticallyEnabledFor<Level>()),
typename ... Args>
941 inline void log(Args && ...) { }
948 TOMOGRAPHER_ENABLED_IF(!HasOwnGetLevel)
949 inline int getLevel()
const 952 return tomo_internal::LoggerRuntimeLevel<HasOwnGetLevel>::level();
955 TOMOGRAPHER_ENABLED_IF(HasOwnGetLevel)
956 inline int getLevel()
const 958 return derived()->level();
962 inline Derived * derived()
964 return static_cast<Derived*
>(
this);
966 inline const Derived * derived()
const 968 return static_cast<const Derived*
>(
this);
971 #ifdef TOMOGRAPHER_PARSED_BY_DOXYGEN 995 TOMOGRAPHER_ENABLED_IF(!HasFilterByOrigin)
996 inline bool _test_filter_by_origin(
int ,
const char * )
const {
return true; }
997 TOMOGRAPHER_ENABLED_IF(HasFilterByOrigin)
998 inline bool _test_filter_by_origin(
int level,
const char * origin)
1000 return derived()->filterByOrigin(level, origin);
1003 inline bool _test_should_emit(
int level,
const char * origin)
1005 return enabledFor(level) && _test_filter_by_origin(level, origin) ;
1008 inline void _do_log(
int level,
const char * origin,
const char * fmt,
va_list ap)
1010 if (_test_should_emit(level, origin)) {
1012 derived()->emitLog(level, origin,
std::move(msg));
1015 inline void _do_log(
int level,
const char * origin,
std::string msg)
1017 if (_test_should_emit(level, origin)) {
1018 derived()->emitLog(level, origin,
std::move(msg));
1022 inline void _do_log(
int level,
const char * origin, Fn f)
1024 if (_test_should_emit(level, origin)) {
1027 derived()->emitLog(level, origin, sstr.
str());
1065 FileLogger(FILE * fp_,
int level =
INFO,
bool display_origin_ =
true)
1091 display_origin = display_origin_;
1094 inline void emitLog(
int level,
const char * origin,
std::string msg)
1115 if (fp != stdout && fp != stderr) {
1123 bool display_origin;
1141 StaticMinimumSeverityLevel = -1
1152 inline void emitLog(
int ,
const char * ,
const std::string & )
1196 inline void emitLog(
int ,
const char * origin,
std::string msg)
1228 return buffer.str();
1238 template<
typename BaseLogger,
int Level>
1245 StaticMinimumSeverityLevel = Level,
1263 template<
typename BaseLogger,
int Level>
1267 BaseLogger & baselogger;
1282 baselogger.emitLog(level, origin,
std::move(msg));
1288 return baselogger.level();
1293 inline
bool filterByOrigin(
int level, const
char * origin)
1295 return baselogger.filterByOrigin(level, origin);
1306 template<
typename BaseLogger>
1327 template<
typename BaseLogger>
1331 BaseLogger & baselogger;
1344 baselogger(baselogger_),
1366 return baselogger.level();
1371 inline
bool filterByOrigin(
int level, const
char * origin)
1373 return baselogger.filterByOrigin(level, origin);
1380 namespace tomo_internal {
1390 while (s[k] == pattern[k]) {
1402 template<
typename BaseLogger>
1408 HasFilterByOrigin = 1
1432 template<
typename BaseLogger>
1437 BaseLogger & baselogger;
1450 baselogger(baselogger_),
1466 levels_set[origin_pattern] = level;
1476 auto it = levels_set.
find(s);
1477 if (it == levels_set.
end()) {
1478 this->warning(
"OriginFilteredLogger<BaseLogger>::removeDomainSetting",
"domain not set: `%s'", s.
c_str());
1481 levels_set.
erase(it);
1503 baselogger.emitLog(level, origin,
std::move(msg));
1521 for (ConstIterator it = levels_set.
begin(); it != levels_set.
end(); ++it) {
1522 const std::size_t mlen = tomo_internal::matched_length((*it).first, s);
1523 if (mlen > last_matched_length) {
1524 loglevel = (*it).second;
1525 last_matched_length = mlen;
1528 if (loglevel == -1) {
1530 loglevel = baselogger.level();
1558 : origin_prefix(s), origin_prefix_add(
""), glue(gl) { }
1561 : origin_prefix(s), origin_prefix_add(s2), glue(gl) { }
1564 namespace tomo_internal {
1566 struct extractTomoOrigin_helper {
1570 return ( fn.substr_e(after_prelast_doublecolons, last_doublecolons) == fn.substr(last_doublecolons+2)
1580 return (prelast_doublecolons_found == std::string::npos) ? 0 : prelast_doublecolons_found+2;
1584 return last_doublecolons == std::string::npos || last_doublecolons == 0
1586 : step2(fn, last_doublecolons, afterprelast_doublecolons(fn.rfind(
"::", last_doublecolons-1)));
1591 return step1(fn, fn.rfind(
"::"));
1608 #define TOMO_ORIGIN Tomographer::Logger::tomo_internal::extractTomoOrigin(TOMO_FUNCTION) 1616 namespace tomo_internal {
1618 template<
typename BaseLoggerType>
1619 struct is_local_logger {
1622 template<
typename BaseLoggerType>
1627 template<
typename BaseLoggerType>
1628 struct local_logger_parent {
1631 template<
typename BaseLoggerType>
1633 typedef typename local_logger_parent<BaseLoggerType>::ParentType ParentType;
1638 template<
typename BaseLoggerType_>
1706 template<
typename BaseLoggerType_>
1708 :
public LoggerBase<LocalLogger<BaseLoggerType_> >
1722 BaseLoggerType & _baselogger;
1736 : Base_(), _origin_prefix(
std::move(origin_fn_name)), _glue(
"::"), _baselogger(logger_)
1738 this->longdebug(
"[begin]");
1747 : Base_(), _origin_prefix(
std::move(origin_prefix)), _glue(
std::move(glue)), _baselogger(logger_)
1749 this->longdebug(
"[begin]");
1757 : Base_(), _origin_prefix(spec.origin_prefix.to_string()+spec.origin_prefix_add.to_string()),
1758 _glue(spec.glue.to_string()), _baselogger(logger_)
1760 this->longdebug(
"[begin]");
1767 : Base_(), _origin_prefix(
std::move(movecopy._origin_prefix)), _glue(
std::move(movecopy._glue)),
1768 _baselogger(movecopy._baselogger)
1770 this->longdebug(
"[logger moved]");
1774 : Base_(), _origin_prefix(other._origin_prefix), _glue(other._glue),
1775 _baselogger(other._baselogger)
1777 this->longdebug(
"[logger copied]");
1782 this->longdebug(
"[done]");
1806 #ifdef TOMOGRAPHER_PARSED_BY_DOXYGEN 1824 typedef typename tomo_internal::local_logger_parent<BaseLoggerType>::ParentType ParentLoggerType;
1827 inline ParentLoggerType & parentLogger()
1829 return baseLogger();
1832 inline ParentLoggerType & parentLogger() {
1833 return baseLogger().parentLogger();
1875 TOMOGRAPHER_ENABLED_IF(Base_::template staticallyEnabledFor<LONGDEBUG>())
1876 PRINTF2_ARGS_SAFE inline
void longdebug(const
char * fmt, ...)
1877 {
va_list ap; va_start(ap, fmt); log<LONGDEBUG>(fmt, ap); va_end(ap); }
1882 TOMOGRAPHER_ENABLED_IF(Base_::template staticallyEnabledFor<DEBUG>())
1883 PRINTF2_ARGS_SAFE inline
void debug(const
char * fmt, ...)
1884 {
va_list ap; va_start(ap, fmt); log<DEBUG>(fmt, ap); va_end(ap); }
1889 TOMOGRAPHER_ENABLED_IF(Base_::template staticallyEnabledFor<INFO>())
1890 PRINTF2_ARGS_SAFE inline
void info(const
char * fmt, ...)
1891 {
va_list ap; va_start(ap, fmt); log<INFO>(fmt, ap); va_end(ap); }
1896 TOMOGRAPHER_ENABLED_IF(Base_::template staticallyEnabledFor<WARNING>())
1897 PRINTF2_ARGS_SAFE inline
void warning(const
char * fmt, ...)
1898 {
va_list ap; va_start(ap, fmt); log<WARNING>(fmt, ap); va_end(ap); }
1903 TOMOGRAPHER_ENABLED_IF(Base_::template staticallyEnabledFor<ERROR>())
1904 PRINTF2_ARGS_SAFE inline
void error(const
char * fmt, ...)
1905 {
va_list ap; va_start(ap, fmt); log<ERROR>(fmt, ap); va_end(ap); }
1911 template<TOMOGRAPHER_ENABLED_IF_TMPL(Base_::
template staticallyEnabledFor<LONGDEBUG>()),
1913 inline void longdebug(Args &&... a) { log<Tomographer::Logger::LONGDEBUG>(std::forward<Args>(a)...); }
1918 template<TOMOGRAPHER_ENABLED_IF_TMPL(Base_::
template staticallyEnabledFor<DEBUG>()),
1920 inline void debug(Args &&... a) { log<Tomographer::Logger::DEBUG>(std::forward<Args>(a)...); }
1925 template<TOMOGRAPHER_ENABLED_IF_TMPL(Base_::
template staticallyEnabledFor<INFO>()),
1927 inline void info(Args &&... a) { log<Tomographer::Logger::INFO>(std::forward<Args>(a)...); }
1932 template<TOMOGRAPHER_ENABLED_IF_TMPL(Base_::
template staticallyEnabledFor<WARNING>()),
1934 inline void warning(Args &&... a) { log<Tomographer::Logger::WARNING>(std::forward<Args>(a)...); }
1939 template<TOMOGRAPHER_ENABLED_IF_TMPL(Base_::
template staticallyEnabledFor<ERROR>()),
1941 inline void error(Args &&... a) { log<Tomographer::Logger::ERROR>(std::forward<Args>(a)...); }
1948 TOMOGRAPHER_ENABLED_IF_TMPL(Base_::template staticallyEnabledFor<Level>()),
1950 inline void log(Args && ... args)
1952 Base_::template log<Level>(
"", std::forward<Args>(args)...);
1957 template<TOMOGRAPHER_ENABLED_IF_TMPL(!Base_::
template staticallyEnabledFor<LONGDEBUG>()),
1961 template<TOMOGRAPHER_ENABLED_IF_TMPL(!Base_::
template staticallyEnabledFor<DEBUG>()),
1965 template<TOMOGRAPHER_ENABLED_IF_TMPL(!Base_::
template staticallyEnabledFor<INFO>()),
1969 template<TOMOGRAPHER_ENABLED_IF_TMPL(!Base_::
template staticallyEnabledFor<WARNING>()),
1973 template<TOMOGRAPHER_ENABLED_IF_TMPL(!Base_::
template staticallyEnabledFor<ERROR>()),
1977 template<
int Level, TOMOGRAPHER_ENABLED_IF_TMPL(!Base_::
template staticallyEnabledFor<Level>()),
1979 inline void log(Args &&... ) { }
1994 return ( origin == NULL || origin[0] == 0
1996 : _origin_prefix + _glue + origin );
2004 _baselogger.emitLog(level, getSubOrigin(origin).c_str(),
std::move(msg));
2010 return _baselogger.level();
2015 inline
bool filterByOrigin(
int level, const
char * origin)
2017 return _baselogger.filterByOrigin(level, getSubOrigin(origin).c_str());
2039 template<
typename BaseLoggerType>
2041 BaseLoggerType & baselogger)
2052 template<
typename BaseLoggerType>
2054 BaseLoggerType & baselogger)
2065 template<
typename BaseLoggerType>
2067 BaseLoggerType & baselogger)
Utilities for formatting strings.
LogLevel(std::string s)
Construct a level using a string level name.
void error(Args &&...)
Special-case implementation for messages which are known to be discarded at compile time...
void warning(Args &&... a)
Generate a log message with level Logger::WARNING.
void emitLog(int level, const char *origin, std::string msg)
Emit a log by relaying to the base logger.
LocalLogger(std::string origin_fn_name, BaseLoggerType &logger_)
Construct a local logger.
std::string originPrefix() const
The fixed origin specified at the constructor.
void info(const char *origin, const char *fmt,...)
emit an information/notice message
Simple logger class which logs everything into a given FILE pointer.
static bool staticallyEnabledFor(int level)
Check whether the logger is statically disabled for some levels.
Local logger: avoid having to repeat origin at each emitted message.
Lowest severity possible.
void emitLog(int level, const char *origin, std::string msg)
Emit a log by relaying to the base logger.
Log messages into an internal memory buffer.
Base namespace for the Tomographer project.
constexpr LocalLoggerOriginSpec(const Tools::conststr &s, const Tools::conststr &s2, const Tools::conststr &gl)
complete constructor.
void longdebug(const char *origin, const char *fmt,...)
emit a very verbose debugging message
void clear()
Clears the internal memory buffer.
void setDomainLevel(const std::string &origin_pattern, int level)
Set a rule to log messages based on their origin.
void warning(Args &&...)
Special-case implementation for messages which are known to be discarded at compile time...
void setLevel(std::string s)
Set the level to the given level name. See class doc.
void log(Args &&...)
Special-case implementation for messages which are known to be discarded at compile time...
void debug(const char *origin, Fn &&f)
emit an debug message
static constexpr bool staticallyEnabledFor()
Static version of staticallyEnabledFor()
void log(const char *origin, const char *fmt, va_list ap)
emit a log message at the given log level.
void log(int level, const char *origin, const char *fmt,...)
emit a log message at the given log level.
Highest severity possible.
void setPrefix(std::string prefix_)
Change the prefix to a new value. Obviously not thread-safe.
const Tools::conststr glue
the glue to use in the local logger
Logger that discards all messages.
void error(const char *origin, Fn &&f)
emit an error message
void info(Args &&...)
Special-case implementation for messages which are known to be discarded at compile time...
Logger which prepends to each origin string a fixed prefix.
void emitLog(int level, const char *origin, std::string msg)
Emit a log by relaying to the base logger.
Object which stores a log level and can initialize from a string.
int level() const
Get the base logger's set level.
int level() const
Get the base logger's set level.
int level() const
Get the stored level code. See LogLevelCode.
void debug(Args &&...)
Statically optimized call if we know at compile time that the message will be discarded.
bool filterByOrigin(int level, const char *origin) const
Message filtering by origin implementation.
OriginFilteredLogger(BaseLogger &baselogger_)
Constructor based on a base logger reference.
ParentLoggerType & parentLogger()
The parent logger responsible for actually emitting the messages in some useful way.
LocalLogger< LocalLogger< BaseLoggerType > > subLogger(std::string new_prefix)
Create a sub-logger.
void setLevel(int level)
Set the level to the given level code. See class doc and LogLevelCode.
void removeDomainSetting(const std::string &s)
Remove a rule set by setDomainLevel()
void log(int level, const char *origin, std::string msg)
emit a log message at the given log level.
void setLogLevel(int level)
Store a new run-time log level.
void log(const char *origin, Fn f)
emit a log message at the given log level.
std::string getSubOrigin(const char *origin) const
The full origin string to use for a sub-logger.
std::string levelName() const
Get the stored level name.
void longdebug(const char *origin, Fn &&f)
emit a very verbose debugging message
Helper for statically determining if Level is at least as severe as BaseLevel.
LocalLogger< LocalLogger< BaseLoggerType > > subLogger(std::string new_prefix, std::string new_glue)
Create a sub-logger.
BaseLoggerType & baseLogger()
The base logger type specified to the constructor.
OriginPrefixedLogger(BaseLogger &baselogger_, std::string prefix_)
Constructor from a base logger.
std::string glue() const
The "glue" string to use to concatenate origins from sub-loggers.
void info(Args &&...)
Statically optimized call if we know at compile time that the message will be discarded.
int level() const
Get the base logger's set level.
bool enabledFor(int level_) const
Check whether messages at the given log level are enabled.
void warning(const char *origin, Fn &&f)
emit a warning message
void info(const char *origin, Fn &&f)
emit an information/notice message
void log(int level, const char *origin, Fn &&f)
emit a log message at the given log level.
LocalLogger(std::string origin_prefix, std::string glue, BaseLoggerType &logger_)
Construct a local logger.
Logger which statically discards any messages less important than a fixed severity.
constexpr LocalLoggerOriginSpec(const Tools::conststr &s, const Tools::conststr &gl)
constructor. origin_prefix_add is left blank.
BaseLoggerType_ BaseLoggerType
The base logger type (see class documentation)
MinimumSeverityLogger(BaseLogger &baselogger_)
Constructor from a base logger.
void emitLog(int level, const char *origin, std::string msg)
Emit a log message (relay to base logger).
void log(const char *origin, const char *fmt,...)
emit a log message at the given log level.
void setDisplayOrigin(bool display_origin_)
Tool to specify arguments to LocalLogger.
LocalLogger< BaseLoggerType > makeLocalLogger(std::string origin_fn_name, BaseLoggerType &baselogger)
Create a local logger.
const Tools::conststr origin_prefix
Origin prefix for the local logger.
void log(Args &&...)
Statically optimized call if we know at compile time that the message will be discarded.
std::ostream & operator<<(std::ostream &str, const LogLevel &l)
C++ output stream operator for LogLevel.
A constexpr string type, suitable for basic compile-time string processing.
LocalLogger(const LocalLogger &other)
Make the local-logger copyable – there's nothing wrong with that.
Default traits for Logger implementations.
void error(const char *origin, const char *fmt,...)
emit an error message
void longdebug(Args &&...)
Statically optimized call if we know at compile time that the message will be discarded.
void debug(Args &&... a)
Generate a log message with level Logger::DEBUG.
void log(const char *origin, std::string msg)
emit a log message at the given log level.
void setLevel(int level)
Changes the runtime log level to a new value.
bool isAtLeastOfSeverity(int level, int baselevel)
Helper to compare severity levels.
void warning(const char *origin, const char *fmt,...)
emit a warning message
Traits template struct to be specialized for specific Logger implementations.
VarValueDecoder< T >::RetType value(const Var &var)
Access the value of the given variable, as a C++ type.
void log(Args &&... args)
Generate a log message with level Level.
_PARENT_LOGGER_TYPE ParentLoggerType
Type of the parent logger type, ultimately responsible for actually emitting the messages in some use...
LocalLogger(const LocalLoggerOriginSpec &spec, BaseLoggerType &logger_)
Construct a local logger.
std::istream & operator>>(std::istream &str, LogLevel &l)
C++ input stream operator for LogLevel.
LoggerBase(int level_=INFO)
Construct the base logger object.
LogLevelCode
Possible logging levels.
const Tools::conststr origin_prefix_add
optionally some string to append to origin_prefix
Long Debug logging level.
std::string getContents() const
get the contents of the internal buffer
LogLevel(const char *s)
Construct a level using a string level name.
int level() const
Unconditionally return LOWEST_SEVERITY_LEVEL for the underlying logging engine.
LogLevel(int level_=INFO)
Construct a level using an integer level code. See LogLevelCode.
void debug(const char *origin, const char *fmt,...)
emit an debug message
int level() const
Get the log level set for this logger.
Basic definitions, which may have to be defined before any Eigen headers or further utilities are inc...
void error(Args &&...)
Statically optimized call if we know at compile time that the message will be discarded.
void warning(Args &&...)
Statically optimized call if we know at compile time that the message will be discarded.
LocalLogger(LocalLogger &&movecopy)
LocalLogger< LocalLogger< BaseLoggerType > > subLogger(const LocalLoggerOriginSpec &spec)
Create a sub-logger.
Information logging level.
#define tomographer_assert(...)
Assertion test macro.
void error(Args &&... a)
Generate a log message with level Logger::ERROR.
void info(Args &&... a)
Generate a log message with level Logger::INFO.
void longdebug(Args &&... a)
Generate a log message with level Logger::LONGDEBUG.
void longdebug(Args &&...)
Special-case implementation for messages which are known to be discarded at compile time...
void debug(Args &&...)
Special-case implementation for messages which are known to be discarded at compile time...
A logger which filters entries according to where they originated from.