-
-
Notifications
You must be signed in to change notification settings - Fork 314
Example Cross Compile Logging for Android & iOS
Bart Louwers edited this page May 21, 2024
·
1 revision
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.
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
MapLibre: online_file_source.cpp activateRequest req->resource.url = https://demotiles.maplibre.org/style.json