ArcGIS Procedural Runtime
3.2.10650
|
#include <Log.h>
Public Member Functions | |
LogFormatter & | log (uint32_t const *array, size_t count) |
LogFormatter (prt::LogLevel l) | |
LogFormatter (prt::LogLevel l, const std::string &s) | |
LogFormatter (prt::LogLevel l, const std::wstring &s) | |
LogFormatter (prt::LogLevel l, const std::string &s, const std::string &p) | |
LogFormatter (prt::LogLevel l, const char *s, const char *p=0) | |
LogFormatter (prt::LogLevel l, const std::wstring &s, const std::wstring &p) | |
LogFormatter (prt::LogLevel l, const std::wstring &s, const std::string &p) | |
LogFormatter (prt::LogLevel l, const wchar_t *s, const wchar_t *p=0) | |
LogFormatter (prt::LogLevel l, const std::exception &e) | |
LogFormatter (prt::LogLevel l, const std::string &s, const std::exception &e) | |
LogFormatter (const LogFormatter &)=delete | |
LogFormatter (LogFormatter &&)=delete | |
LogFormatter & | operator% (float x) |
LogFormatter & | operator% (double x) |
LogFormatter & | operator% (long int x) |
LogFormatter & | operator% (std::size_t x) |
LogFormatter & | operator% (uint8_t x) |
LogFormatter & | operator% (uint16_t x) |
LogFormatter & | operator% (uint32_t x) |
LogFormatter & | operator% (uint64_t x) |
LogFormatter & | operator% (int8_t x) |
LogFormatter & | operator% (int16_t x) |
LogFormatter & | operator% (int32_t x) |
LogFormatter & | operator% (int64_t x) |
LogFormatter & | operator% (const char *x) |
LogFormatter & | operator% (const std::string &x) |
LogFormatter & | operator% (const StringVector &x) |
LogFormatter & | operator% (const wchar_t *x) |
LogFormatter & | operator% (const std::wstring &x) |
LogFormatter & | operator% (const WStringVector &x) |
LogFormatter & | operator% (const prt::Status &x) |
LogFormatter & | operator% (const prt::LogLevel &x) |
LogFormatter & | operator% (const URIPtr &x) |
LogFormatter & | operator% (const BoundingBox &x) |
LogFormatter & | operator% (const DoubleVector &x) |
LogFormatter & | operator% (const ReportsPtr &r) |
LogFormatter & | operator% (const std::vector< uint32_t > &v) |
LogFormatter & | operator= (const LogFormatter &)=delete |
LogFormatter & | operator= (LogFormatter &&)=delete |
Protected Member Functions | |
std::wstring | getMessage () const |
LogFormatter is a log message formatter with support for both char and wchar_t arguments. Internally, it uses boost::format syntax to format the log message with "%1%, %2%, ..." syntax. See http://www.boost.org/doc/libs/1_66_0/libs/format/doc/format.html#examples for details.
Each log message has an associated log level. The message will be logged if its level is equal or greater than the globally set log level (see prt::init()).
The logging is triggered when the LogFormatter instance is destroyed, i.e. is going out of scope.
It is recommended to use LogFormatter through these convenience macros (char / wchar_t version):
Important: In order to output log messages to the console or into a log file, a log handler must be added with prt::addLogHandler(). There are two default log handlers for your convenience: prt::ConsoleLogHandler (uses std::wlog/wcout with UTF-16) and prt::FileLogHandler (UTF-8).
A typical use case:
|
explicit |
Generates a log message with the implicit formatting string "%1%". Useful to just log a single string, e.g.
log_info() % myString
prtx::LogFormatter::LogFormatter | ( | prt::LogLevel | l, |
const std::string & | s | ||
) |
Generates a log message with the formatting string s. This is the most commonly used constructor.
prtx::LogFormatter::LogFormatter | ( | prt::LogLevel | l, |
const std::string & | s, | ||
const std::string & | p | ||
) |
Generates a log message with the formatting string s and an optional prefix p. Useful for marking log messages from a submodule or class.
prtx::LogFormatter::LogFormatter | ( | prt::LogLevel | l, |
const std::exception & | e | ||
) |
Convenience constructor to directly log an exception message.
prtx::LogFormatter::LogFormatter | ( | prt::LogLevel | l, |
const std::string & | s, | ||
const std::exception & | e | ||
) |
Convenience constructor to log an exception message with a prefix string s.