summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej S. Szmigiero <mail@maciej.szmigiero.name>2022-10-07 16:39:44 +0200
committerMaciej S. Szmigiero <mail@maciej.szmigiero.name>2022-10-11 14:51:36 +0200
commitdc90a358e8410c8f4a631aca2167e2b24f46af9c (patch)
tree5db6a21b88d76b55a5bcdc8782a183a09815fc80
parent3610c139deeffa8db5144f08430d5b33151cd0a9 (diff)
downloadgeoclue-dc90a358e8410c8f4a631aca2167e2b24f46af9c.tar.gz
Make debug messages more specific which location source they pertain
And consolidate duplicate ones.
-rw-r--r--src/gclue-location-source.c2
-rw-r--r--src/gclue-locator.c15
-rw-r--r--src/gclue-nmea-source.c14
-rw-r--r--src/gclue-web-source.c17
-rw-r--r--src/gclue-wifi.c6
5 files changed, 29 insertions, 25 deletions
diff --git a/src/gclue-location-source.c b/src/gclue-location-source.c
index 1179b8d..0c77022 100644
--- a/src/gclue-location-source.c
+++ b/src/gclue-location-source.c
@@ -448,7 +448,7 @@ gclue_location_source_set_location (GClueLocationSource *source,
"latitude", latitude,
"accuracy", accuracy,
NULL);
- g_debug ("location scrambled");
+ g_debug ("%s location scrambled", G_OBJECT_TYPE_NAME (source));
}
speed = gclue_location_get_speed (location);
diff --git a/src/gclue-locator.c b/src/gclue-locator.c
index a7dd890..d9e8cdc 100644
--- a/src/gclue-locator.c
+++ b/src/gclue-locator.c
@@ -81,15 +81,14 @@ static GParamSpec *gParamSpecs[LAST_PROP];
static void
set_location (GClueLocator *locator,
- GClueLocation *location)
+ GClueLocation *location,
+ const char *src_name)
{
GClueLocation *cur_location;
cur_location = gclue_location_source_get_location
(GCLUE_LOCATION_SOURCE (locator));
- g_debug ("New location available");
-
if (cur_location != NULL) {
guint64 cur_timestamp, new_timestamp;
double dist, speed;
@@ -97,7 +96,8 @@ set_location (GClueLocator *locator,
cur_timestamp = gclue_location_get_timestamp (cur_location);
new_timestamp = gclue_location_get_timestamp (location);
if (new_timestamp < cur_timestamp) {
- g_debug ("New location older than current, ignoring.");
+ g_debug ("New %s location older than current, ignoring.",
+ src_name);
return;
}
@@ -126,11 +126,12 @@ set_location (GClueLocator *locator,
* a reasonable speed, OR it is more or as accurate as
* the previous one.
*/
- g_debug ("Ignoring less accurate new location");
+ g_debug ("Ignoring less accurate new %s location", src_name);
return;
}
}
+ g_debug ("New location available from %s", src_name);
gclue_location_source_set_location (GCLUE_LOCATION_SOURCE (locator),
location);
}
@@ -183,7 +184,7 @@ on_location_changed (GObject *gobject,
GClueLocation *location;
location = gclue_location_source_get_location (source);
- set_location (locator, location);
+ set_location (locator, location, G_OBJECT_TYPE_NAME (source));
}
static gboolean
@@ -206,7 +207,7 @@ start_source (GClueLocator *locator,
location = gclue_location_source_get_location (src);
if (gclue_location_source_get_active (src) && location != NULL)
- set_location (locator, location);
+ set_location (locator, location, G_OBJECT_TYPE_NAME (src));
gclue_location_source_start (src);
}
diff --git a/src/gclue-nmea-source.c b/src/gclue-nmea-source.c
index ea267f7..248a2be 100644
--- a/src/gclue-nmea-source.c
+++ b/src/gclue-nmea-source.c
@@ -247,7 +247,7 @@ refresh_accuracy_level (GClueNMEASource *source)
return;
}
- g_debug ("Scheduling accuracy level refresh");
+ g_debug ("Scheduling NMEA accuracy level refresh");
priv->accuracy_refresh_source = g_idle_add (on_refresh_accuracy_level,
source);
}
@@ -260,7 +260,7 @@ on_service_unbreak_time (gpointer source)
priv->unbreak_timer = 0;
if (!priv->try_services && priv->broken_services) {
- g_debug ("Unbreaking existing services");
+ g_debug ("Unbreaking existing NMEA services");
priv->try_services = priv->broken_services;
priv->broken_services = NULL;
@@ -278,7 +278,7 @@ check_unbreak_timer (GClueNMEASource *source)
if (priv->try_services || !priv->broken_services) {
if (priv->unbreak_timer) {
- g_debug ("Removing unnecessary unbreaking timer");
+ g_debug ("Removing unnecessary NMEA unbreaking timer");
g_source_remove (priv->unbreak_timer);
priv->unbreak_timer = 0;
@@ -291,7 +291,7 @@ check_unbreak_timer (GClueNMEASource *source)
return;
}
- g_debug ("Scheduling unbreaking timer");
+ g_debug ("Scheduling NMEA unbreaking timer");
priv->unbreak_timer = g_timeout_add_seconds (SERVICE_UNBREAK_TIME,
on_service_unbreak_time,
source);
@@ -356,7 +356,7 @@ add_new_service (GClueNMEASource *source,
GEnumValue *enum_value;
if (check_service_exists (source, name)) {
- g_debug ("Service %s already exists", name);
+ g_debug ("NMEA service %s already exists", name);
return;
}
@@ -718,13 +718,13 @@ on_read_nmea_sentence (GObject *object,
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
return;
} else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED)) {
- g_debug ("Socket closed.");
+ g_debug ("NMEA socket closed.");
} else {
g_warning ("Error when receiving message: %s",
error->message);
}
} else {
- g_debug ("Nothing to read");
+ g_debug ("NMEA nothing to read");
}
service_broken (source);
diff --git a/src/gclue-web-source.c b/src/gclue-web-source.c
index 4db92d5..fb09f4b 100644
--- a/src/gclue-web-source.c
+++ b/src/gclue-web-source.c
@@ -98,7 +98,6 @@ gclue_web_source_real_refresh_async (GClueWebSource *source,
"Network unavailable");
return;
}
- g_debug ("Network available");
if (source->priv->query != NULL) {
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_PENDING,
@@ -144,7 +143,8 @@ refresh_callback (SoupSession *session,
if (query->status_code != SOUP_STATUS_OK) {
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Failed to query location: %s", query->reason_phrase);
+ "Query location SOUP error: %s",
+ query->reason_phrase);
return;
}
@@ -187,10 +187,15 @@ query_callback (GObject *source_object,
location = GCLUE_WEB_SOURCE_GET_CLASS (web)->refresh_finish (web, result, &local_error);
if (local_error != NULL &&
- !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_INITIALIZED) &&
!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- g_warning ("Failed to query location: %s", local_error->message);
- return;
+ if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_INITIALIZED) &&
+ !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_PENDING)) {
+ g_warning ("Failed to query location: %s",
+ local_error->message);
+ } else {
+ g_debug ("Failed to query location: %s",
+ local_error->message);
+ }
}
}
@@ -265,7 +270,7 @@ gclue_web_source_finalize (GObject *gsource)
}
if (priv->query != NULL) {
- g_debug ("Cancelling query");
+ g_debug ("Cancelling web source query");
soup_session_cancel_message (priv->soup_session,
priv->query,
SOUP_STATUS_CANCELLED);
diff --git a/src/gclue-wifi.c b/src/gclue-wifi.c
index 0afaf1a..ac7544a 100644
--- a/src/gclue-wifi.c
+++ b/src/gclue-wifi.c
@@ -503,7 +503,6 @@ on_scan_timeout (gpointer user_data)
GClueWifi *wifi = GCLUE_WIFI (user_data);
GClueWifiPrivate *priv = wifi->priv;
- g_debug ("WiFi scan timeout.");
priv->scan_timeout = 0;
if (priv->interface == NULL)
@@ -532,7 +531,7 @@ on_scan_wait_done (gpointer wifi)
if (priv->bss_list_changed) {
priv->bss_list_changed = FALSE;
- g_debug ("Refreshing location…");
+ g_debug ("WiFi BSS list changed, refreshing location…");
gclue_mozilla_set_bss_dirty (priv->mozilla);
gclue_web_source_refresh (GCLUE_WEB_SOURCE (wifi));
}
@@ -564,7 +563,6 @@ on_scan_done (WPAInterface *object,
return;
}
- g_debug ("WiFi scan completed");
if (priv->interface == NULL)
return;
@@ -594,7 +592,7 @@ on_scan_done (WPAInterface *object,
priv->scan_timeout = g_timeout_add_seconds (timeout,
on_scan_timeout,
wifi);
- g_debug ("Next scan scheduled in %u seconds", timeout);
+ g_debug ("WiFi scan done, next scheduled in %u seconds", timeout);
}
static void