From 7ae66e5f53d29b019bb23e582d4e82a44dad689d Mon Sep 17 00:00:00 2001 From: heck Date: Fri, 16 Apr 2021 03:44:46 +0200 Subject: [PATCH] pEpLog / pEpSQLite - the "magic" logger alias can be private --- src/pEpLog.hh | 4 ++-- src/pEpSQLite.hh | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pEpLog.hh b/src/pEpLog.hh index 0edeb42..d8a15a3 100644 --- a/src/pEpLog.hh +++ b/src/pEpLog.hh @@ -72,9 +72,9 @@ namespace pEp { // pEpLogger can only print the "thread - file::class::function - " format using this macro // WARNING: Some magic is needed // Usage: -// Just create your logger member in your class (public) +// create your logger obj in your class as a public member (usually) // Adapter::pEpLog::pEpLogger logger{"", enabled: true|false}; -// then, create an alias for your logger called "m4gic_logger_n4ame" +// then, create an alias for your logger called "m4gic_logger_n4ame" as a private member // Adapter::pEpLog::pEpLogger& m4gic_logger_n4ame = logger; // Thats all. // Now in your implementation, to log a message you just write: diff --git a/src/pEpSQLite.hh b/src/pEpSQLite.hh index 865dae9..ebf7b52 100644 --- a/src/pEpSQLite.hh +++ b/src/pEpSQLite.hh @@ -35,13 +35,12 @@ namespace pEp { // logging static bool log_enabled; Adapter::pEpLog::pEpLogger logger{"pEpSQLite", log_enabled}; - Adapter::pEpLog::pEpLogger& m4gic_logger_n4ame = logger; ~pEpSQLite(); private: ::sqlite3 *db = nullptr; std::string db_path; ResultSet resultset; - + Adapter::pEpLog::pEpLogger& m4gic_logger_n4ame = logger; static int callback(void *obj, int argc, char **argv, char **azColName); }; } // namespace pEp