wex v24.10.0
|
This class offers logging. More...
#include <wex/core/log.h>
Public Types | |
enum class | level_t { TRACE , DEBUG , INFO , WARNING , ERRORS , FATAL , STATUS , OFF } |
The log levels supported. More... | |
Public Member Functions | |
log (const std::string &topic=std::string()) | |
Default constructor. | |
log (const std::exception &) | |
Constructor for error level from a std exception. | |
log (const pugi::xml_parse_result &) | |
Constructor for error level from a pugi parse result. | |
~log () | |
Destructor, flushes stringstream to logging. | |
log & | operator<< (bool) |
Supported loggers. | |
log & | operator<< (int) |
Logs int according to level. | |
log & | operator<< (unsigned int) |
Logs unsigned int according to level. | |
log & | operator<< (size_t) |
Logs size_t according to level. | |
log & | operator<< (long) |
Logs long according to level. | |
log & | operator<< (long long) |
Logs long long according to level. | |
log & | operator<< (char) |
Logs char according to level. | |
log & | operator<< (char *) |
Logs char* according to level. | |
log & | operator<< (const std::stringstream &ss) |
Logs stringstream according to level. | |
log & | operator<< (const std::string &) |
Logs string according to level. | |
log & | operator<< (const char *) |
Logs char* according to level. | |
log & | operator<< (const wchar_t *) |
Logs char* according to level. | |
template<std::size_t N> | |
log & | operator<< (const std::bitset< N > &b) |
Logs a bitset according to level. | |
log & | operator<< (const pugi::xml_node &) |
Logs pugi according to level. | |
template<typename T > | |
log & | operator<< (const T &t) |
Logs template class T according to level. | |
const std::string | get () const |
Returns topic and current logging. | |
Static Public Member Functions | |
static void | on_init (level_t loglevel=level_t_def(), const std::string &logfile=std::string()) |
Initializes logging, and optionally sets logfile. | |
static level_t | get_level () |
Return current filter log level. | |
static std::string | get_level_info () |
Returns info for log levels. | |
static level_t | level_t_def () |
Returns default log level. | |
static const std::string | path () |
Returns path for actual logfile used. | |
static void | set_level (level_t loglevel) |
Sets filter log level. | |
static log | debug (const std::string &topic=std::string()) |
Builds a debug level logger. | |
static log | fatal (const std::string &topic=std::string()) |
Builds a fatal level logger. | |
static log | info (const std::string &topic=std::string()) |
Builds a info level logger. | |
static log | status (const std::string &topic=std::string()) |
Builds a status level logger. | |
static log | trace (const std::string &topic=std::string()) |
Builds a trace level logger. | |
static log | warning (const std::string &topic=std::string()) |
Builds a warning level logger. | |
This class offers logging.
|
strong |
|
explicit |
Default constructor.
This prepares a error level logging.
|
static |
Initializes logging, and optionally sets logfile.
Should be called before constructing a log object. The wex::cmdline_imp or wex::app::OnInit takes care of this.
loglevel | loglevel |
logfile | logfile, empty string uses a default logfile |
log & wex::log::operator<< | ( | bool | ) |
Supported loggers.
Logs bool according to level.
|
inline |
Logs template class T according to level.
You need a log method inside your template class.