diff --git a/dom/system/gonk/GonkGPSGeolocationProvider.cpp b/dom/system/gonk/GonkGPSGeolocationProvider.cpp index 5ad23c67d6e7..fa62d30c1d42 100644 --- a/dom/system/gonk/GonkGPSGeolocationProvider.cpp +++ b/dom/system/gonk/GonkGPSGeolocationProvider.cpp @@ -56,13 +56,6 @@ #define FLUSH_AIDE_DATA 0 -#undef LOG -#undef ERR -#undef DBG -#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GonkGPSGeolocationProvider", ## args) -#define ERR(args...) __android_log_print(ANDROID_LOG_ERROR, "GonkGPSGeolocationProvider", ## args) -#define DBG(args...) __android_log_print(ANDROID_LOG_DEBUG, "GonkGPSGeolocationProvider" , ## args) - using namespace mozilla; using namespace mozilla::dom; @@ -146,10 +139,10 @@ GonkGPSGeolocationProvider::LocationCallback(GpsLocation* location) // set in the DOM JS. if (gDebug_isLoggingEnabled) { - DBG("geo: GPS got a fix (%f, %f). accuracy: %f", - location->latitude, - location->longitude, - location->accuracy); + nsContentUtils::LogMessageToConsole("geo: GPS got a fix (%f, %f). accuracy: %f", + location->latitude, + location->longitude, + location->accuracy); } RefPtr event = new UpdateLocationEvent(somewhere); @@ -206,7 +199,7 @@ GonkGPSGeolocationProvider::StatusCallback(GpsStatus* status) break; } if (gDebug_isLoggingEnabled){ - DBG("%s", msgStream); + nsContentUtils::LogMessageToConsole(msgStream); } } @@ -247,7 +240,7 @@ GonkGPSGeolocationProvider::SvStatusCallback(GpsSvStatus* sv_info) svEphemerisCount != numEphemeris || svUsedCount != numUsedInFix) { - LOG( + nsContentUtils::LogMessageToConsole( "geo: Number of SVs have (visibility, almanac, ephemeris): (%d, %d, %d)." " %d of these SVs were used in fix.\n", sv_info->num_svs, svAlmanacCount, svEphemerisCount, svUsedCount); @@ -264,7 +257,8 @@ void GonkGPSGeolocationProvider::NmeaCallback(GpsUtcTime timestamp, const char* nmea, int length) { if (gDebug_isLoggingEnabled) { - DBG("NMEA: timestamp:\t%lld, length: %d, %s", timestamp, length, nmea); + nsContentUtils::LogMessageToConsole("geo: NMEA: timestamp:\t%lld, length: %d, %s", + timestamp, length, nmea); } } @@ -538,13 +532,15 @@ GonkGPSGeolocationProvider::RequestSettingValue(const char* aKey) nsCOMPtr lock; nsresult rv = ss->CreateLock(nullptr, getter_AddRefs(lock)); if (NS_FAILED(rv)) { - ERR("error while createLock setting '%s': %d\n", aKey, rv); + nsContentUtils::LogMessageToConsole( + "geo: error while createLock setting '%s': %d\n", aKey, rv); return; } rv = lock->Get(aKey, this); if (NS_FAILED(rv)) { - ERR("error while get setting '%s': %d\n", aKey, rv); + nsContentUtils::LogMessageToConsole( + "geo: error while get setting '%s': %d\n", aKey, rv); return; } } @@ -643,8 +639,8 @@ ConvertToGpsRefLocationType(const nsAString& aConnectionType) } if (gDebug_isLoggingEnabled) { - DBG("geo: Unsupported connection type %s\n", - NS_ConvertUTF16toUTF8(aConnectionType).get()); + nsContentUtils::LogMessageToConsole("geo: Unsupported connection type %s\n", + NS_ConvertUTF16toUTF8(aConnectionType).get()); } return AGPS_REF_LOCATION_TYPE_GSM_CELLID; } @@ -748,7 +744,8 @@ GonkGPSGeolocationProvider::InjectLocation(double latitude, float accuracy) { if (gDebug_isLoggingEnabled) { - DBG("injecting location (%f, %f) accuracy: %f", latitude, longitude, accuracy); + nsContentUtils::LogMessageToConsole("geo: injecting location (%f, %f) accuracy: %f", + latitude, longitude, accuracy); } MOZ_ASSERT(NS_IsMainThread()); @@ -950,12 +947,14 @@ GonkGPSGeolocationProvider::NetworkLocationUpdate::Update(nsIDOMGeoPosition *pos (isGPSTempInactive && delta > kMinMLSCoordChangeInMeters)) { if (gDebug_isLoggingEnabled) { - DBG("Using MLS, GPS age:%fs, MLS Delta:%fm\n", diff_ms / 1000.0, delta); + nsContentUtils::LogMessageToConsole("geo: Using MLS, GPS age:%fs, MLS Delta:%fm\n", + diff_ms / 1000.0, delta); } provider->mLocationCallback->Update(position); } else if (provider->mLastGPSPosition) { if (gDebug_isLoggingEnabled) { - DBG("Using old GPS age:%fs\n", diff_ms / 1000.0); + nsContentUtils::LogMessageToConsole("geo: Using old GPS age:%fs\n", + diff_ms / 1000.0); } // This is a fallback case so that the GPS provider responds with its last @@ -1186,15 +1185,16 @@ GonkGPSGeolocationProvider::Observe(nsISupports* aSubject, } if (setting.mKey.EqualsASCII(kSettingDebugGpsIgnored)) { - LOG("received mozsettings-changed: ignoring\n"); + nsContentUtils::LogMessageToConsole("geo: received mozsettings-changed: ignoring\n"); gDebug_isGPSLocationIgnored = setting.mValue.isBoolean() ? setting.mValue.toBoolean() : false; if (gDebug_isLoggingEnabled) { - DBG("GPS ignored %d\n", gDebug_isGPSLocationIgnored); + nsContentUtils::LogMessageToConsole("geo: Debug: GPS ignored %d\n", + gDebug_isGPSLocationIgnored); } return NS_OK; } else if (setting.mKey.EqualsASCII(kSettingDebugEnabled)) { - LOG("received mozsettings-changed: logging\n"); + nsContentUtils::LogMessageToConsole("geo: received mozsettings-changed: logging\n"); gDebug_isLoggingEnabled = setting.mValue.isBoolean() ? setting.mValue.toBoolean() : false; return NS_OK;