|
| | ALogger (AString filename) |
| | Constructor for an extra log file.
|
| |
|
void | setDebugMode (bool debug) |
| |
|
bool | isDebug () |
| |
| void | setLogFile (APath path) |
| | Sets log file.
|
| |
|
APath | logFile () |
| |
|
void | onLogged (std::function< void(const AString &prefix, const AString &message, Level level)> callback) |
| |
| template<aui::invocable Callable> |
| void | doLogFileAccessSafe (Callable action) |
| | Allows to perform some action (access safely) on log file (which is opened all over the execution process)
|
| |
| LogWriter | log (Level level, const AString &prefix) |
| | Writer a log entry with LogWriter helper.
|
| |
Logger is used for journaling application events like errors or some user actions.
It provides some extra functions like logging to file and output formatting.
It provides std::cout-like API.
Example:
ALogger::info("MyApp") << "Hello world!";
Possible output:
[00:47:02][UI Thread][Logger][INFO]: Hello world!
It's convenient to define LOG_TAG variable for your class:
static constexpr auto LOG_TAG = "MyDownloader";
class MyDownloader {
public:
void someAction() {
ALogger::info(LOG_TAG) << "someAction() called";
}
void downloadFile(const AString& name) {
ALogger::info(LOG_TAG) << "Downloading file: " << name;
}
}
Represents a Unicode character string.
Definition AString.h:38