[core] fix logging so we don't use strings as a formatter
This commit is contained in:
@@ -139,7 +139,7 @@ int main(int argc, char *argv[]) {
|
||||
map.setStyleURL(newStyle.url);
|
||||
view->setWindowTitle(newStyle.name);
|
||||
|
||||
mbgl::Log::Info(mbgl::Event::Setup, std::string("Changed style to: ") + newStyle.name);
|
||||
mbgl::Log::Info(mbgl::Event::Setup, "Changed style to: %s", newStyle.name);
|
||||
});
|
||||
|
||||
// Load style
|
||||
|
||||
@@ -180,7 +180,7 @@ int main(int argc, char* argv[]) {
|
||||
map.setStyleURL(newStyle.url);
|
||||
view.setWindowTitle(newStyle.name);
|
||||
|
||||
mbgl::Log::Info(mbgl::Event::Setup, std::string("Changed style to: ") + newStyle.name);
|
||||
mbgl::Log::Info(mbgl::Event::Setup, "Changed style to: %s", newStyle.name);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ Image::Image(std::string const& data)
|
||||
}
|
||||
catch (ImageReaderException const& ex)
|
||||
{
|
||||
Log::Error(Event::Image, ex.what());
|
||||
Log::Error(Event::Image, "%s", ex.what());
|
||||
img.reset();
|
||||
width = 0;
|
||||
height = 0;
|
||||
|
||||
@@ -134,7 +134,7 @@ void SQLiteCache::Impl::get(const Resource &resource, Callback callback) {
|
||||
Log::Error(Event::Database, ex.code, ex.what());
|
||||
callback(nullptr);
|
||||
} catch (std::runtime_error& ex) {
|
||||
Log::Error(Event::Database, ex.what());
|
||||
Log::Error(Event::Database, "%s", ex.what());
|
||||
callback(nullptr);
|
||||
}
|
||||
}
|
||||
@@ -204,7 +204,7 @@ void SQLiteCache::Impl::put(const Resource& resource, std::shared_ptr<const Resp
|
||||
} catch (mapbox::sqlite::Exception& ex) {
|
||||
Log::Error(Event::Database, ex.code, ex.what());
|
||||
} catch (std::runtime_error& ex) {
|
||||
Log::Error(Event::Database, ex.what());
|
||||
Log::Error(Event::Database, "%s", ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ stopwatch::stopwatch(const std::string &name_, EventSeverity severity_, Event ev
|
||||
void stopwatch::report(const std::string &name_) {
|
||||
Duration duration = Clock::now() - start;
|
||||
|
||||
Log::Record(severity, event, name_ + ": " + util::toString(std::chrono::duration_cast<std::chrono::milliseconds>(duration).count()) + "ms");
|
||||
Log::Record(severity, event, "%s: %fms", name_.c_str(), std::chrono::duration<float, std::chrono::milliseconds::period>(duration).count());
|
||||
start += duration;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user