Skip to Content

[!WARNING]
This information may be out-of-date.

Add this to your header.

#include <iostream> #include <sstream> #define LOG_TAG "# MapLibre " #ifdef __ANDROID__ #include <android/log.h> #endif

Then you can use this sample code which compiles for both Android & Xcode.

std::stringstream message; // Set your message to log. message << LOG_TAG << __FUNCTION__ << " req->resource.url = " << req->resource.url << std::endl; // Logs to Xcode console. std::cout << message.str(); #ifdef __ANDROID__ // Logs to Android Logcat. __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, "%s", message.str().c_str()); #endif

Which will log the following samples.

Android Sample Logging Output

com.mapbox.mapboxsdk.testapp D/# MapLibre: online_file_source.cpp: # MapLibre: online_file_source.cpp activateRequest req->resource.url = https://api.maptiler.com/tiles/v3/tiles.json

Xcode Sample Logging Output

MapLibre: online_file_source.cpp activateRequest req->resource.url = https://demotiles.maplibre.org/style.json

Last updated on