diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2015-03-09 15:42:11 +0200 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-03-12 13:28:40 +0200 |
commit | 2948e7d121343359b817d2fb0eb383e257ab84c8 (patch) | |
tree | f16ef0c923774abe4d2eb2c2e888ffe22238e926 /src | |
parent | ba9d2420699507c6d32b12272151529663c8d2fd (diff) | |
download | qtlocation-mapboxgl-2948e7d121343359b817d2fb0eb383e257ab84c8.tar.gz |
Simplify the logging mechanism
Move the implementation of the more specialized methods to the base
class and let the platform implement only the most generic method that
takes all the possible arguments.
These specialized methods will then map to the generic implementation
that must be provided by the platforms we support.
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/platform/log.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mbgl/platform/log.cpp b/src/mbgl/platform/log.cpp index b83c7a9322..71463dc2f9 100644 --- a/src/mbgl/platform/log.cpp +++ b/src/mbgl/platform/log.cpp @@ -1,7 +1,27 @@ #include <mbgl/platform/log.hpp> +#include <cstdarg> + namespace mbgl { std::unique_ptr<LogBackend> Log::Backend; +void LogBackend::record(EventSeverity severity, Event event, const std::string &msg) { + record(severity, event, -1, msg); +} + +void LogBackend::record(EventSeverity severity, Event event, const char* format, ...) { + va_list args; + va_start(args, format); + char msg[4096]; + vsnprintf(msg, sizeof(msg), format, args); + va_end(args); + + record(severity, event, -1, msg); +} + +void LogBackend::record(EventSeverity severity, Event event, int64_t code) { + record(severity, event, code, std::string()); +} + } |