From a67aaca56b21f334018a5d10e3d5a691bdc4e98a Mon Sep 17 00:00:00 2001 From: Juha Alanen Date: Tue, 31 Mar 2020 11:08:11 +0300 Subject: [core] Move logging off the main thread --- include/mbgl/util/logging.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/mbgl/util/logging.hpp b/include/mbgl/util/logging.hpp index 03db2d7462..1b72d74738 100644 --- a/include/mbgl/util/logging.hpp +++ b/include/mbgl/util/logging.hpp @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -36,6 +37,11 @@ private: } public: + Log(); + ~Log(); + + static void useLogThread(bool enable); + template static void Debug(Event event, Args&& ...args) { Record(EventSeverity::Debug, event, ::std::forward(args)...); @@ -66,15 +72,23 @@ public: } private: + static Log* get() noexcept; + static void record(EventSeverity severity, Event event, const std::string &msg); static void record(EventSeverity severity, Event event, const char* format = "", ...); static void record(EventSeverity severity, Event event, int64_t code, const char* format = "", ...); - static void record(EventSeverity severity, Event event, int64_t code, const std::string &msg); + static void record(EventSeverity severity, + Event event, + int64_t code, + const std::string& msg, + const optional& threadName); // This method is the data sink that must be implemented by each platform we // support. It should ideally output the error message in a human readable // format to the developer. static void platformRecord(EventSeverity severity, const std::string &msg); + class Impl; + const std::unique_ptr impl; }; } // namespace mbgl -- cgit v1.2.1