summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2015-03-10 16:13:53 +0200
committerThiago Marcos P. Santos <thiago@mapbox.com>2015-03-12 13:28:41 +0200
commit79f3149d9d973a31bcc5cf3ba1dbe77d90884ace (patch)
treea23ea65597fb0848f65850d1d65d2b31ba9275a3 /include
parent51bc265db341f1d98b4fd46be80241771f854eb5 (diff)
downloadqtlocation-mapboxgl-79f3149d9d973a31bcc5cf3ba1dbe77d90884ace.tar.gz
Update the FixtureLog
Now the FixtureLog is an Log::Observer instead of a backend. The observer can sniff and filter log messages, that can be used for fail a test if it emits a warning for example.
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/platform/log.hpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/mbgl/platform/log.hpp b/include/mbgl/platform/log.hpp
index e6b8f17b65..de7f131714 100644
--- a/include/mbgl/platform/log.hpp
+++ b/include/mbgl/platform/log.hpp
@@ -11,6 +11,18 @@
namespace mbgl {
class Log {
+public:
+ class Observer {
+ public:
+ virtual ~Observer() = default;
+
+ // When an observer is set, this function will be called for every log
+ // message. Returning true will consume the message.
+ virtual bool onRecord(EventSeverity severity, Event event, int64_t code, const std::string &msg) = 0;
+ };
+
+ static void setObserver(std::unique_ptr<Observer> Observer);
+
private:
template <typename T, size_t N>
constexpr static bool includes(const T e, const T (&l)[N], const size_t i = 0) {