|
libqi-api
2.4.3.28
|
Convenient log macro. More...
#include <string>#include <iostream>#include <sstream>#include <cstdarg>#include <cstdio>#include <boost/format.hpp>#include <boost/function/function_fwd.hpp>#include <qi/os.hpp>#include <qi/detail/warn_push_ignore_deprecated.hpp>#include <qi/detail/warn_pop_ignore_deprecated.hpp>#include <qi/detail/log.hxx>Go to the source code of this file.
Namespaces | |
| qi | |
| qi::log | |
| Log functions with different levels of verbosity. | |
| qi::log::detail | |
Macros | |
| #define | _QI_LOG_HPP_ |
| #define | qiLogCategory(Cat) |
| #define | qiLogDebug(...) _QI_LOG_MESSAGE_STREAM(LogLevel_Debug, Debug , __VA_ARGS__) |
| #define | qiLogDebugF(Msg,...) _QI_LOG_MESSAGE(LogLevel_Debug, _QI_LOG_FORMAT(Msg, __VA_ARGS__)) |
| #define | qiLogVerbose(...) _QI_LOG_MESSAGE_STREAM(LogLevel_Verbose, Verbose, __VA_ARGS__) |
| Log in verbose mode. This level is not shown by default. More... | |
| #define | qiLogVerboseF(Msg,...) _QI_LOG_MESSAGE(LogLevel_Verbose, _QI_LOG_FORMAT(Msg, __VA_ARGS__)) |
| #define | qiLogInfo(...) _QI_LOG_MESSAGE_STREAM(LogLevel_Info, Info, __VA_ARGS__) |
| Log in info mode. More... | |
| #define | qiLogInfoF(Msg,...) _QI_LOG_MESSAGE(LogLevel_Info, _QI_LOG_FORMAT(Msg, __VA_ARGS__)) |
| #define | qiLogWarning(...) _QI_LOG_MESSAGE_STREAM(LogLevel_Warning, Warning, __VA_ARGS__) |
| Log in warning mode. More... | |
| #define | qiLogWarningF(Msg,...) _QI_LOG_MESSAGE(LogLevel_Warning, _QI_LOG_FORMAT(Msg, __VA_ARGS__)) |
| #define | qiLogError(...) _QI_LOG_MESSAGE_STREAM(LogLevel_Error, Error, __VA_ARGS__) |
| Log in error mode. More... | |
| #define | qiLogErrorF(Msg,...) _QI_LOG_MESSAGE(LogLevel_Error, _QI_LOG_FORMAT(Msg, __VA_ARGS__)) |
| #define | qiLogFatal(...) _QI_LOG_MESSAGE_STREAM(LogLevel_Fatal, Fatal, __VA_ARGS__) |
| Log in fatal mode. More... | |
| #define | qiLogFatalF(Msg,...) _QI_LOG_MESSAGE(LogLevel_Fatal, _QI_LOG_FORMAT(Msg, __VA_ARGS__)) |
Typedefs | |
| typedef int | qi::LogContext |
| Logs context attribute value. More... | |
| typedef unsigned int | qi::log::SubscriberId |
| Subscriber Identifier. More... | |
| typedef boost::function7< void, const qi::LogLevel, const qi::os::timeval, const char *, const char *, const char *, const char *, int > | qi::log::logFuncHandler |
| Boost delegate to log function (verbosity lv, date of log, category, message, file, function, line). More... | |
| typedef boost::function8< void, const qi::LogLevel, const qi::Clock::time_point, const qi::SystemClock::time_point, const char *, const char *, const char *, const char *, int > | qi::log::Handler |
| Boost delegate to log function (verbosity lv, dates of log, category, message, file, function, line). More... | |
Enumerations | |
| enum | qi::LogLevel { qi::LogLevel_Silent = 0, qi::LogLevel_Fatal, qi::LogLevel_Error, qi::LogLevel_Warning, qi::LogLevel_Info, qi::LogLevel_Verbose, qi::LogLevel_Debug } |
| Log level verbosity. More... | |
| enum | qi::LogColor { qi::LogColor_Never, qi::LogColor_Auto, qi::LogColor_Always } |
| Logs color mode. More... | |
| enum | qi::LogContextAttr { qi::LogContextAttr_None = 0, qi::LogContextAttr_Verbosity = 1 << 0, qi::LogContextAttr_ShortVerbosity = 1 << 1, qi::LogContextAttr_SystemDate = 1 << 2, qi::LogContextAttr_Tid = 1 << 3, qi::LogContextAttr_Category = 1 << 4, qi::LogContextAttr_File = 1 << 5, qi::LogContextAttr_Function = 1 << 6, qi::LogContextAttr_Return = 1 << 7, qi::LogContextAttr_Date = 1 << 8 } |
| Logs context attribute. More... | |
Functions | |
| void | qi::log::init (qi::LogLevel verb=qi::LogLevel_Info, qi::LogContext context=qi::LogContextAttr_ShortVerbosity|qi::LogContextAttr_Tid|qi::LogContextAttr_Category, bool synchronous=true) |
| Initialization of the logging system (could be avoided) More... | |
| void | qi::log::destroy () |
| Stop and flush the logging system. More... | |
| void | qi::log::log (const qi::LogLevel verb, const char *category, const char *msg, const char *file="", const char *fct="", const int line=0) |
| Log function. You should call qiLog* macros instead. More... | |
| void | qi::log::log (const qi::LogLevel verb, CategoryType category, const std::string &msg, const char *file="", const char *fct="", const int line=0) |
| Log function. You should call qiLog* macros instead. More... | |
| const char * | qi::log::logLevelToString (const qi::LogLevel verb, bool verbose=true) |
| Convert log verbosity to a readable string. More... | |
| qi::LogLevel | qi::log::stringToLogLevel (const char *verb) |
| Convert string to log verbosity. More... | |
| void | qi::log::setLogLevel (const qi::LogLevel lv, SubscriberId sub=0) |
| Set log Level. More... | |
| qi::LogLevel | qi::log::logLevel (SubscriberId sub=0) |
| Get log verbosity. More... | |
| std::vector< std::string > | qi::log::categories () |
| Get the list of all categories. More... | |
| CategoryType | qi::log::addCategory (const std::string &name) |
| Add/get a category. More... | |
| void | qi::log::enableCategory (const std::string &cat, SubscriberId sub=0) |
| Set category to current verbosity level. Globbing is supported. More... | |
| void | qi::log::disableCategory (const std::string &cat, SubscriberId sub=0) |
| Set category to silent log level. Globbing is supported. More... | |
| bool | qi::log::isVisible (CategoryType category, qi::LogLevel level) |
| Check if the given combination of category and level is enable. More... | |
| bool | qi::log::isVisible (const std::string &category, qi::LogLevel level) |
| Check if the given combination of category and level is enable. More... | |
| void | qi::log::addFilters (const std::string &rules, SubscriberId sub=0) |
| Parse and execute a set of verbosity rules. More... | |
| void | qi::log::addFilter (const std::string &cat, qi::LogLevel level, SubscriberId sub=0) |
| Set per-subscriber category to level. Globbing is supported. More... | |
| void | qi::log::setContext (int ctx) |
| Set log context verbosity. More... | |
| int | qi::log::context () |
| Get log context. More... | |
| void | qi::log::setColor (LogColor color) |
| Set log color. More... | |
| LogColor | qi::log::color () |
| Get log color. More... | |
| void | qi::log::setSynchronousLog (bool sync) |
| Enables or disables synchronous logs. More... | |
| SubscriberId | qi::log::addHandler (const std::string &name, qi::log::Handler fct, qi::LogLevel defaultLevel=LogLevel_Info) |
| Add a log handler. More... | |
| QI_API_DEPRECATED SubscriberId | qi::log::addLogHandler (const std::string &name, qi::log::logFuncHandler fct, qi::LogLevel defaultLevel=LogLevel_Info) |
| Add a log handler. More... | |
| void | qi::log::removeHandler (const std::string &name) |
| Remove a log handler. More... | |
| QI_API_DEPRECATED void | qi::log::removeLogHandler (const std::string &name) |
| Remove a log handler. More... | |
| void | qi::log::flush () |
| Flush asynchronous logs. More... | |
| QI_API_DEPRECATED void | qi::log::setVerbosity (SubscriberId sub, const qi::log::LogLevel lv) |
| QI_API_DEPRECATED void | qi::log::setCategory (SubscriberId sub, const std::string &cat, qi::log::LogLevel level) |
| QI_API_DEPRECATED qi::LogLevel | qi::log::verbosity (SubscriberId sub=0) |
| QI_API_DEPRECATED void | qi::log::setVerbosity (const std::string &rules, SubscriberId sub=0) |
| Parse and execute a set of verbosity rules. More... | |
| QI_API_DEPRECATED void | qi::log::setVerbosity (const qi::LogLevel lv, SubscriberId sub=0) |
| Set log Level. More... | |
| QI_API_DEPRECATED void | qi::log::setCategory (const std::string &catName, qi::LogLevel level, SubscriberId sub=0) |
Variables | |
| QI_API_DEPRECATED typedef qi::LogLevel | qi::log::LogLevel |
| QI_API_DEPRECATED typedef unsigned int | qi::log::Subscriber |
Convenient log macro.
Definition in file log.hpp.
| #define qiLogCategory | ( | Cat | ) |
* Add default category for the current scope.
* Each log has a category defined by the call to qiLogCategory()
* found in scope. So you must call qiLogCategory() at least once, for
* instance at the beginning of your source file or function.
*
* .. code-block:: cpp
*
* {
* qiLogCategory(my.category);
* qiLogInfoF("1 + 1 is %s", 1+1);
* qiLogInfo() << "1 + 1 is " << 1+1;
* }
*
| #define qiLogDebug | ( | ... | ) | _QI_LOG_MESSAGE_STREAM(LogLevel_Debug, Debug , __VA_ARGS__) |
* Log in debug mode. Not compiled on release and not shown by default.
* Use as follow:
*
* .. code-block:: cpp
*
* qiLogDebug("foo.bar", "my foo is %d bar", 42);
* // or
* qiLogDebug("foo.bar") << "my foo is " << 42 << "bar";
*
* If you don't want to see any log, use silent log level.
*
| #define qiLogDebugF | ( | Msg, | |
| ... | |||
| ) | _QI_LOG_MESSAGE(LogLevel_Debug, _QI_LOG_FORMAT(Msg, __VA_ARGS__)) |
| #define qiLogError | ( | ... | ) | _QI_LOG_MESSAGE_STREAM(LogLevel_Error, Error, __VA_ARGS__) |
| #define qiLogErrorF | ( | Msg, | |
| ... | |||
| ) | _QI_LOG_MESSAGE(LogLevel_Error, _QI_LOG_FORMAT(Msg, __VA_ARGS__)) |
| #define qiLogFatal | ( | ... | ) | _QI_LOG_MESSAGE_STREAM(LogLevel_Fatal, Fatal, __VA_ARGS__) |
| #define qiLogFatalF | ( | Msg, | |
| ... | |||
| ) | _QI_LOG_MESSAGE(LogLevel_Fatal, _QI_LOG_FORMAT(Msg, __VA_ARGS__)) |
| #define qiLogInfo | ( | ... | ) | _QI_LOG_MESSAGE_STREAM(LogLevel_Info, Info, __VA_ARGS__) |
| #define qiLogInfoF | ( | Msg, | |
| ... | |||
| ) | _QI_LOG_MESSAGE(LogLevel_Info, _QI_LOG_FORMAT(Msg, __VA_ARGS__)) |
| #define qiLogVerbose | ( | ... | ) | _QI_LOG_MESSAGE_STREAM(LogLevel_Verbose, Verbose, __VA_ARGS__) |
| #define qiLogVerboseF | ( | Msg, | |
| ... | |||
| ) | _QI_LOG_MESSAGE(LogLevel_Verbose, _QI_LOG_FORMAT(Msg, __VA_ARGS__)) |
| #define qiLogWarning | ( | ... | ) | _QI_LOG_MESSAGE_STREAM(LogLevel_Warning, Warning, __VA_ARGS__) |
| #define qiLogWarningF | ( | Msg, | |
| ... | |||
| ) | _QI_LOG_MESSAGE(LogLevel_Warning, _QI_LOG_FORMAT(Msg, __VA_ARGS__)) |