summaryrefslogtreecommitdiff
path: root/src/mbgl/util
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-06-07 14:49:41 +0200
committerKonstantin Käfer <mail@kkaefer.com>2018-06-12 17:41:16 +0200
commit2b2de05612eaf4dbacdf5112996045bd8efeb800 (patch)
treee035823061fdcd4e666b3223be70ad2c5865a044 /src/mbgl/util
parentbed86b98f11088cd2ed6354696e9aa8e762f95be (diff)
downloadqtlocation-mapboxgl-2b2de05612eaf4dbacdf5112996045bd8efeb800.tar.gz
[core] allow logging error codes and formatting strings at the same time
Diffstat (limited to 'src/mbgl/util')
-rw-r--r--src/mbgl/util/logging.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mbgl/util/logging.cpp b/src/mbgl/util/logging.cpp
index 0552eb36cb..d322bd3670 100644
--- a/src/mbgl/util/logging.cpp
+++ b/src/mbgl/util/logging.cpp
@@ -38,8 +38,14 @@ void Log::record(EventSeverity severity, Event event, const char* format, ...) {
record(severity, event, -1, msg);
}
-void Log::record(EventSeverity severity, Event event, int64_t code) {
- record(severity, event, code, std::string());
+void Log::record(EventSeverity severity, Event event, int64_t code, 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, code, std::string{ msg });
}
void Log::record(EventSeverity severity, Event event, int64_t code, const std::string &msg) {