summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2015-03-11 17:19:16 +0200
committerThiago Marcos P. Santos <thiago@mapbox.com>2015-03-12 14:19:32 +0200
commit124b49562ddfe951ad82243b56a859a46a58bd57 (patch)
treedbee0d9b9e6432401e033637eb80bc71fa05a42a /platform
parent2b6afe6a549284a862d0231653d2183d57a5b496 (diff)
downloadqtlocation-mapboxgl-124b49562ddfe951ad82243b56a859a46a58bd57.tar.gz
Get rid of printf and cout by using Log::*
Use our logging system that will route the message accordingly on the target platform. Fixes #613
Diffstat (limited to 'platform')
-rw-r--r--platform/default/glfw_view.cpp6
-rw-r--r--platform/default/headless_view.cpp2
-rw-r--r--platform/default/image.cpp8
-rw-r--r--platform/default/png_reader.cpp4
-rw-r--r--platform/ios/MGLMapView.mm2
5 files changed, 11 insertions, 11 deletions
diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp
index 2d0da355b2..601ae0ec2d 100644
--- a/platform/default/glfw_view.cpp
+++ b/platform/default/glfw_view.cpp
@@ -25,7 +25,7 @@ void GLFWView::initialize(mbgl::Map *map_) {
glfwSetErrorCallback(glfwError);
if (!glfwInit()) {
- fprintf(stderr, "Failed to initialize glfw\n");
+ mbgl::Log::Error(mbgl::Event::OpenGL, "failed to initialize glfw");
exit(1);
}
@@ -54,7 +54,7 @@ void GLFWView::initialize(mbgl::Map *map_) {
window = glfwCreateWindow(1024, 768, "Mapbox GL", monitor, NULL);
if (!window) {
glfwTerminate();
- fprintf(stderr, "Failed to initialize window\n");
+ mbgl::Log::Error(mbgl::Event::OpenGL, "failed to initialize window");
exit(1);
}
@@ -312,7 +312,7 @@ void GLFWView::fps() {
double currentTime = glfwGetTime();
if (currentTime - timeElapsed >= 1) {
- fprintf(stderr, "FPS: %4.2f\n", frames / (currentTime - timeElapsed));
+ mbgl::Log::Info(mbgl::Event::OpenGL, "FPS: %4.2f", frames / (currentTime - timeElapsed));
timeElapsed = currentTime;
frames = 0;
}
diff --git a/platform/default/headless_view.cpp b/platform/default/headless_view.cpp
index 7509c48eec..df85ee714c 100644
--- a/platform/default/headless_view.cpp
+++ b/platform/default/headless_view.cpp
@@ -125,7 +125,7 @@ void HeadlessView::createContext() {
glContext = glXCreateNewContext(xDisplay, fbConfigs[0], GLX_RGBA_TYPE, None, True);
if (glContext) {
if (!glXIsDirect(xDisplay, glContext)) {
- mbgl::Log::Error(mbgl::Event::OpenGL, "Failed to create direct OpenGL Legacy context");
+ Log::Error(Event::OpenGL, "failed to create direct OpenGL Legacy context");
glXDestroyContext(xDisplay, glContext);
glContext = 0;
}
diff --git a/platform/default/image.cpp b/platform/default/image.cpp
index 311aa2ed72..1a10d78ffa 100644
--- a/platform/default/image.cpp
+++ b/platform/default/image.cpp
@@ -32,14 +32,14 @@ std::string compress_png(int width, int height, void *rgba) {
png_voidp error_ptr = 0;
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, error_ptr, NULL, NULL);
if (!png_ptr) {
- Log::Error(Event::Image, "Couldn't create png_ptr");
+ Log::Error(Event::Image, "couldn't create png_ptr");
return "";
}
png_infop info_ptr = png_create_info_struct(png_ptr);
if (!png_ptr) {
png_destroy_write_struct(&png_ptr, (png_infopp)0);
- Log::Error(Event::Image, "Couldn't create info_ptr");
+ Log::Error(Event::Image, "couldn't create info_ptr");
return "";
}
@@ -87,7 +87,7 @@ Image::Image(std::string const& data)
}
catch (ImageReaderException const& ex)
{
- fprintf(stderr, "Image: %s\n", ex.what());
+ Log::Error(Event::Image, ex.what());
img.reset();
width = 0;
height = 0;
@@ -95,7 +95,7 @@ Image::Image(std::string const& data)
}
catch (...) // catch the rest
{
- fprintf(stderr, "Image: exception in constructor");
+ Log::Error(Event::Image, "exception in constructor");
img.reset();
width = 0;
height = 0;
diff --git a/platform/default/png_reader.cpp b/platform/default/png_reader.cpp
index cf96ca2363..91fe007bcf 100644
--- a/platform/default/png_reader.cpp
+++ b/platform/default/png_reader.cpp
@@ -1,4 +1,5 @@
#include <mbgl/platform/default/png_reader.hpp>
+#include <mbgl/platform/log.hpp>
#include <iostream>
extern "C"
{
@@ -23,8 +24,7 @@ void user_error_fn(png_structp /*png_ptr*/, png_const_charp error_msg)
void user_warning_fn(png_structp /*png_ptr*/, png_const_charp warning_msg)
{
- fprintf(stderr, "ImageReader (PNG): %s\n", warning_msg);
-
+ Log::Warning(Event::Image, "ImageReader (PNG): %s", warning_msg);
}
template <typename T>
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index 57760717d9..f99653b1e5 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -187,7 +187,7 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
if ( ! _context)
{
- mbgl::Log::Error(mbgl::Event::Setup, "Failed to create OpenGL ES context");
+ mbgl::Log::Error(mbgl::Event::Setup, "failed to create OpenGL ES context");
return NO;
}