[plugins 2/3] log: use the new logging API from core



From: Damien Lespiau <damien lespiau intel com>

This commit adapts the logging code to the new GRL_* defines and log
domain code.

See the corresponding commit in core for further details.

https://bugzilla.gnome.org/show_bug.cgi?id=627864

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez igalia com>
---
 src/apple-trailers/grl-apple-trailers.c   |   16 ++--
 src/bookmarks/grl-bookmarks.c             |   88 +++++++++--------
 src/fake-metadata/grl-fake-metadata.c     |   17 ++--
 src/filesystem/grl-filesystem.c           |   31 ++++---
 src/flickr/gflickr.c                      |   16 ++-
 src/flickr/grl-flickr.c                   |   24 +++--
 src/flickr/grl-flickr.h                   |    3 +
 src/gravatar/grl-gravatar.c               |   15 ++-
 src/jamendo/grl-jamendo.c                 |   24 +++--
 src/lastfm-albumart/grl-lastfm-albumart.c |   19 ++--
 src/metadata-store/grl-metadata-store.c   |   66 +++++++------
 src/podcasts/grl-podcasts.c               |  148 +++++++++++++++--------------
 src/shoutcast/grl-shoutcast.c             |   22 +++--
 src/upnp/grl-upnp.c                       |   86 +++++++++--------
 src/vimeo/grl-vimeo.c                     |   16 ++--
 src/youtube/grl-youtube.c                 |   76 ++++++++-------
 test/main.c                               |   76 ++++++++--------
 17 files changed, 395 insertions(+), 348 deletions(-)

diff --git a/src/apple-trailers/grl-apple-trailers.c b/src/apple-trailers/grl-apple-trailers.c
index a6dd86c..58d00df 100644
--- a/src/apple-trailers/grl-apple-trailers.c
+++ b/src/apple-trailers/grl-apple-trailers.c
@@ -38,8 +38,8 @@
 
 /* --------- Logging  -------- */
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "grl-apple-trailers"
+#define GRL_LOG_DOMAIN_DEFAULT apple_trailers_log_domain
+GRL_LOG_DOMAIN_STATIC(apple_trailers_log_domain);
 
 /* ---- Apple Trailers Service ---- */
 
@@ -92,7 +92,9 @@ grl_apple_trailers_plugin_init (GrlPluginRegistry *registry,
   GrlAppleTrailersSource *source;
   gboolean hd = FALSE;
 
-  g_debug ("apple_trailers_plugin_init\n");
+  GRL_LOG_DOMAIN_INIT (apple_trailers_log_domain, "apple-trailers");
+
+  GRL_DEBUG ("apple_trailers_plugin_init");
 
   for (; configs; configs = g_list_next (configs)) {
     GrlConfig *config;
@@ -125,7 +127,7 @@ grl_apple_trailers_source_new (gboolean high_definition)
 {
   GrlAppleTrailersSource *source;
 
-  g_debug ("grl_apple_trailers_source_new%s", high_definition ? " (HD)" : "");
+  GRL_DEBUG ("grl_apple_trailers_source_new%s", high_definition ? " (HD)" : "");
   source = g_object_new (GRL_APPLE_TRAILERS_SOURCE_TYPE,
                          "source-id", SOURCE_ID,
                          "source-name", SOURCE_NAME,
@@ -425,7 +427,7 @@ read_url_async (const gchar *url, gpointer user_data)
 
   vfs = g_vfs_get_default ();
 
-  g_debug ("Opening '%s'", url);
+  GRL_DEBUG ("Opening '%s'", url);
   uri = g_vfs_get_file_for_uri (vfs, url);
   g_file_load_contents_async (uri, NULL, read_done_cb, user_data);
 }
@@ -461,7 +463,7 @@ grl_apple_trailers_source_browse (GrlMediaSource *source,
   GrlAppleTrailersSource *at_source = (GrlAppleTrailersSource *) source;
   OperationData *op_data;
 
-  g_debug ("grl_apple_trailers_source_browse");
+  GRL_DEBUG ("grl_apple_trailers_source_browse");
 
   op_data = g_slice_new0 (OperationData);
   op_data->bs = bs;
@@ -479,7 +481,7 @@ grl_apple_trailers_source_cancel (GrlMediaSource *source, guint operation_id)
 {
   OperationData *op_data;
 
-  g_debug ("grl_apple_trailers_source_cancel");
+  GRL_DEBUG ("grl_apple_trailers_source_cancel");
 
   op_data = (OperationData *) grl_media_source_get_operation_data (source, operation_id);
 
diff --git a/src/bookmarks/grl-bookmarks.c b/src/bookmarks/grl-bookmarks.c
index e382c74..d14c9ae 100644
--- a/src/bookmarks/grl-bookmarks.c
+++ b/src/bookmarks/grl-bookmarks.c
@@ -40,8 +40,8 @@
 
 /* --------- Logging  -------- */
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "grl-bookmarks"
+#define GRL_LOG_DOMAIN_DEFAULT bookmarks_log_domain
+GRL_LOG_DOMAIN_STATIC(bookmarks_log_domain);
 
 /* --- Database --- */
 
@@ -180,7 +180,9 @@ grl_bookmarks_plugin_init (GrlPluginRegistry *registry,
                            const GrlPluginInfo *plugin,
                            GList *configs)
 {
-  g_debug ("grl_bookmarks_plugin_init\n");
+  GRL_LOG_DOMAIN_INIT (bookmarks_log_domain, "bookmarks");
+
+  GRL_DEBUG ("grl_bookmarks_plugin_init");
 
   GrlBookmarksSource *source = grl_bookmarks_source_new ();
   grl_plugin_registry_register_source (registry,
@@ -198,7 +200,7 @@ GRL_PLUGIN_REGISTER (grl_bookmarks_plugin_init,
 static GrlBookmarksSource *
 grl_bookmarks_source_new (void)
 {
-  g_debug ("grl_bookmarks_source_new");
+  GRL_DEBUG ("grl_bookmarks_source_new");
   return g_object_new (GRL_BOOKMARKS_SOURCE_TYPE,
 		       "source-id", SOURCE_ID,
 		       "source-name", SOURCE_NAME,
@@ -242,11 +244,11 @@ grl_bookmarks_source_init (GrlBookmarksSource *source)
 
   home = g_getenv ("HOME");
   if (!home) {
-    g_warning ("$HOME not set, cannot open database");
+    GRL_WARNING ("$HOME not set, cannot open database");
     return;
   }
 
-  g_debug ("Opening database connection...");
+  GRL_DEBUG ("Opening database connection...");
   db_path = g_strconcat (home, G_DIR_SEPARATOR_S, GRL_SQL_DB, NULL);
   r = sqlite3_open (db_path, &source->priv->db);
   if (r) {
@@ -255,24 +257,24 @@ grl_bookmarks_source_init (GrlBookmarksSource *source)
     sqlite3_close (source->priv->db);
     return;
   }
-  g_debug ("  OK");
+  GRL_DEBUG ("  OK");
 
-  g_debug ("Checking database tables...");
+  GRL_DEBUG ("Checking database tables...");
   r = sqlite3_exec (source->priv->db, GRL_SQL_CREATE_TABLE_BOOKMARKS,
 		    NULL, NULL, &sql_error);
 
   if (r) {
     if (sql_error) {
-      g_warning ("Failed to create database tables: %s", sql_error);
+      GRL_WARNING ("Failed to create database tables: %s", sql_error);
       sqlite3_free (sql_error);
       sql_error = NULL;
     } else {
-      g_warning ("Failed to create database tables.");
+      GRL_WARNING ("Failed to create database tables.");
     }
     sqlite3_close (source->priv->db);
     return;
   }
-  g_debug ("  OK");
+  GRL_DEBUG ("  OK");
 
   g_free (db_path);
 }
@@ -284,7 +286,7 @@ grl_bookmarks_source_finalize (GObject *object)
 {
   GrlBookmarksSource *source;
 
-  g_debug ("grl_bookmarks_source_finalize");
+  GRL_DEBUG ("grl_bookmarks_source_finalize");
 
   source = GRL_BOOKMARKS_SOURCE (object);
 
@@ -374,7 +376,7 @@ bookmark_metadata (GrlMediaSourceMetadataSpec *ms)
   gchar *sql;
   const gchar *id;
   
-  g_debug ("bookmark_metadata");
+  GRL_DEBUG ("bookmark_metadata");
 
   db = GRL_BOOKMARKS_SOURCE (ms->source)->priv->db;
 
@@ -387,12 +389,12 @@ bookmark_metadata (GrlMediaSourceMetadataSpec *ms)
   }
 
   sql = g_strdup_printf (GRL_SQL_GET_BOOKMARK_BY_ID, id);
-  g_debug ("%s", sql);
+  GRL_DEBUG ("%s", sql);
   r = sqlite3_prepare_v2 (db, sql, strlen (sql), &sql_stmt, NULL);
   g_free (sql);
 
   if (r != SQLITE_OK) {
-    g_warning ("Failed to get bookmark: %s", sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to get bookmark: %s", sqlite3_errmsg (db));
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_METADATA_FAILED,
 			 "Failed to get bookmark metadata");
@@ -407,7 +409,7 @@ bookmark_metadata (GrlMediaSourceMetadataSpec *ms)
     build_media_from_stmt (ms->media, sql_stmt);
     ms->callback (ms->source, ms->media, ms->user_data, NULL);
   } else {
-    g_warning ("Failed to get bookmark: %s", sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to get bookmark: %s", sqlite3_errmsg (db));
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_METADATA_FAILED,
 			 "Failed to get bookmark metadata");
@@ -430,14 +432,14 @@ produce_bookmarks_from_sql (OperationSpec *os, const gchar *sql)
   guint count = 0;
   GList *iter;
 
-  g_debug ("produce_bookmarks_from_sql");
+  GRL_DEBUG ("produce_bookmarks_from_sql");
 
-  g_debug ("%s", sql);
+  GRL_DEBUG ("%s", sql);
   db = GRL_BOOKMARKS_SOURCE (os->source)->priv->db;
   r = sqlite3_prepare_v2 (db, sql, strlen (sql), &sql_stmt, NULL);
 
   if (r != SQLITE_OK) {
-    g_warning ("Failed to retrieve bookmarks: %s", sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to retrieve bookmarks: %s", sqlite3_errmsg (db));
     error = g_error_new (GRL_CORE_ERROR,
 			 os->error_code,
 			 "Failed to retrieve bookmarks list");
@@ -456,7 +458,7 @@ produce_bookmarks_from_sql (OperationSpec *os, const gchar *sql)
   }
 
   if (r != SQLITE_DONE) {
-    g_warning ("Failed to retrieve bookmarks: %s", sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to retrieve bookmarks: %s", sqlite3_errmsg (db));
     error = g_error_new (GRL_CORE_ERROR,
 			 os->error_code,
 			 "Failed to retrieve bookmarks list");
@@ -492,7 +494,7 @@ static void
 produce_bookmarks_by_query (OperationSpec *os, const gchar *query)
 {
   gchar *sql;
-  g_debug ("produce_bookmarks_by_query");
+  GRL_DEBUG ("produce_bookmarks_by_query");
   sql = g_strdup_printf (GRL_SQL_GET_BOOKMARKS_BY_QUERY,
 			 query, os->count, os->skip);    
   produce_bookmarks_from_sql (os, sql);
@@ -503,7 +505,7 @@ static void
 produce_bookmarks_by_text (OperationSpec *os, const gchar *text)
 {
   gchar *sql;
-  g_debug ("produce_bookmarks_by_text");
+  GRL_DEBUG ("produce_bookmarks_by_text");
   sql = g_strdup_printf (GRL_SQL_GET_BOOKMARKS_BY_TEXT,
 			 text, text, os->count, os->skip);    
   produce_bookmarks_from_sql (os, sql);
@@ -514,7 +516,7 @@ static void
 produce_bookmarks_from_category (OperationSpec *os, const gchar *category_id)
 {
   gchar *sql;
-  g_debug ("produce_bookmarks_from_category");
+  GRL_DEBUG ("produce_bookmarks_from_category");
   sql = g_strdup_printf (GRL_SQL_GET_BOOKMARKS_BY_PARENT,
 			 category_id, os->count, os->skip);    
   produce_bookmarks_from_sql (os, sql);
@@ -528,15 +530,15 @@ remove_bookmark (sqlite3 *db, const gchar *bookmark_id, GError **error)
   gchar *sql_error;
   gchar *sql;
 
-  g_debug ("remove_bookmark");
+  GRL_DEBUG ("remove_bookmark");
 
   sql = g_strdup_printf (GRL_SQL_REMOVE_BOOKMARK, bookmark_id, bookmark_id);
-  g_debug ("%s", sql);
+  GRL_DEBUG ("%s", sql);
   r = sqlite3_exec (db, sql, NULL, NULL, &sql_error);
   g_free (sql);
 
   if (r != SQLITE_OK) {
-    g_warning ("Failed to remove bookmark '%s': %s", bookmark_id, sql_error);
+    GRL_WARNING ("Failed to remove bookmark '%s': %s", bookmark_id, sql_error);
     *error = g_error_new (GRL_CORE_ERROR,
 			  GRL_CORE_ERROR_REMOVE_FAILED,
 			  "Failed to remove bookmark");
@@ -544,7 +546,7 @@ remove_bookmark (sqlite3 *db, const gchar *bookmark_id, GError **error)
   }
 
   /* Remove orphan nodes from database */
-  g_debug ("%s", GRL_SQL_REMOVE_ORPHAN);
+  GRL_DEBUG ("%s", GRL_SQL_REMOVE_ORPHAN);
   r = sqlite3_exec (db, GRL_SQL_REMOVE_ORPHAN, NULL, NULL, NULL);
 }
 
@@ -566,7 +568,7 @@ store_bookmark (sqlite3 *db,
   guint type;
   gchar *id;
 
-  g_debug ("store_bookmark");
+  GRL_DEBUG ("store_bookmark");
 
   title = grl_media_get_title (bookmark);
   url = grl_media_get_url (bookmark);
@@ -584,20 +586,21 @@ store_bookmark (sqlite3 *db,
     parent_id = "0";
   }
 
-  g_debug ("%s", GRL_SQL_STORE_BOOKMARK);
+  GRL_DEBUG ("%s", GRL_SQL_STORE_BOOKMARK);
   r = sqlite3_prepare_v2 (db,
 			  GRL_SQL_STORE_BOOKMARK,
 			  strlen (GRL_SQL_STORE_BOOKMARK),
 			  &sql_stmt, NULL);
   if (r != SQLITE_OK) {
-    g_warning ("Failed to store bookmark '%s': %s", title, sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to store bookmark '%s': %s", title,
+                 sqlite3_errmsg (db));
     *error = g_error_new (GRL_CORE_ERROR,
 			  GRL_CORE_ERROR_STORE_FAILED,
 			  "Failed to store bookmark '%s'", title);
     return;
   }
 
-  g_debug ("URL: '%s'", url);
+  GRL_DEBUG ("URL: '%s'", url);
 
   if (GRL_IS_MEDIA_BOX (bookmark)) {
     type = BOOKMARK_TYPE_CATEGORY;
@@ -632,7 +635,8 @@ store_bookmark (sqlite3 *db,
   while ((r = sqlite3_step (sql_stmt)) == SQLITE_BUSY);
 
   if (r != SQLITE_DONE) {
-    g_warning ("Failed to store bookmark '%s': %s", title, sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to store bookmark '%s': %s", title,
+                 sqlite3_errmsg (db));
     *error = g_error_new (GRL_CORE_ERROR,
 			  GRL_CORE_ERROR_STORE_FAILED,
 			  "Failed to store bookmark '%s'", title);
@@ -669,7 +673,7 @@ static void
 grl_bookmarks_source_browse (GrlMediaSource *source,
                             GrlMediaSourceBrowseSpec *bs)
 {
-  g_debug ("grl_bookmarks_source_browse");
+  GRL_DEBUG ("grl_bookmarks_source_browse");
 
   OperationSpec *os;
   GrlBookmarksSource *bookmarks_source;
@@ -677,7 +681,7 @@ grl_bookmarks_source_browse (GrlMediaSource *source,
 
   bookmarks_source = GRL_BOOKMARKS_SOURCE (source);
   if (!bookmarks_source->priv->db) {
-    g_warning ("Can't execute operation: no database connection.");
+    GRL_WARNING ("Can't execute operation: no database connection.");
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_BROWSE_FAILED,
 			 "No database connection");
@@ -704,7 +708,7 @@ static void
 grl_bookmarks_source_search (GrlMediaSource *source,
 			     GrlMediaSourceSearchSpec *ss)
 {
-  g_debug ("grl_bookmarks_source_search");
+  GRL_DEBUG ("grl_bookmarks_source_search");
 
   GrlBookmarksSource *bookmarks_source;
   OperationSpec *os;
@@ -712,7 +716,7 @@ grl_bookmarks_source_search (GrlMediaSource *source,
 
   bookmarks_source = GRL_BOOKMARKS_SOURCE (source);
   if (!bookmarks_source->priv->db) {
-    g_warning ("Can't execute operation: no database connection.");
+    GRL_WARNING ("Can't execute operation: no database connection.");
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_QUERY_FAILED,
 			 "No database connection");
@@ -736,7 +740,7 @@ static void
 grl_bookmarks_source_query (GrlMediaSource *source,
 			    GrlMediaSourceQuerySpec *qs)
 {
-  g_debug ("grl_bookmarks_source_query");
+  GRL_DEBUG ("grl_bookmarks_source_query");
 
   GrlBookmarksSource *bookmarks_source;
   OperationSpec *os;
@@ -744,7 +748,7 @@ grl_bookmarks_source_query (GrlMediaSource *source,
 
   bookmarks_source = GRL_BOOKMARKS_SOURCE (source);
   if (!bookmarks_source->priv->db) {
-    g_warning ("Can't execute operation: no database connection.");
+    GRL_WARNING ("Can't execute operation: no database connection.");
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_QUERY_FAILED,
 			 "No database connection");
@@ -767,7 +771,7 @@ grl_bookmarks_source_query (GrlMediaSource *source,
 static void
 grl_bookmarks_source_store (GrlMediaSource *source, GrlMediaSourceStoreSpec *ss)
 {
-  g_debug ("grl_bookmarks_source_store");
+  GRL_DEBUG ("grl_bookmarks_source_store");
   /* FIXME: Try to guess bookmark mime somehow */
   GError *error = NULL;
   store_bookmark (GRL_BOOKMARKS_SOURCE (ss->source)->priv->db,
@@ -781,7 +785,7 @@ grl_bookmarks_source_store (GrlMediaSource *source, GrlMediaSourceStoreSpec *ss)
 static void grl_bookmarks_source_remove (GrlMediaSource *source,
 					 GrlMediaSourceRemoveSpec *rs)
 {
-  g_debug ("grl_bookmarks_source_remove");
+  GRL_DEBUG ("grl_bookmarks_source_remove");
   GError *error = NULL;
   remove_bookmark (GRL_BOOKMARKS_SOURCE (rs->source)->priv->db,
 		   rs->media_id, &error);
@@ -795,14 +799,14 @@ static void
 grl_bookmarks_source_metadata (GrlMediaSource *source,
 			       GrlMediaSourceMetadataSpec *ms)
 {
-  g_debug ("grl_bookmarks_source_metadata");
+  GRL_DEBUG ("grl_bookmarks_source_metadata");
 
   GrlBookmarksSource *bookmarks_source;
   GError *error = NULL;
 
   bookmarks_source = GRL_BOOKMARKS_SOURCE (source);
   if (!bookmarks_source->priv->db) {
-    g_warning ("Can't execute operation: no database connection.");
+    GRL_WARNING ("Can't execute operation: no database connection.");
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_METADATA_FAILED,
 			 "No database connection");
diff --git a/src/fake-metadata/grl-fake-metadata.c b/src/fake-metadata/grl-fake-metadata.c
index 60bfae2..c762e35 100644
--- a/src/fake-metadata/grl-fake-metadata.c
+++ b/src/fake-metadata/grl-fake-metadata.c
@@ -28,8 +28,8 @@
 
 #include "grl-fake-metadata.h"
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "grl-fake-metadata"
+#define GRL_LOG_DOMAIN_DEFAULT fake_metadata_log_domain
+GRL_LOG_DOMAIN_STATIC(fake_metadata_log_domain);
 
 #define PLUGIN_ID   FAKEMETADATA_PLUGIN_ID
 
@@ -69,7 +69,10 @@ grl_fake_metadata_source_plugin_init (GrlPluginRegistry *registry,
                                       const GrlPluginInfo *plugin,
                                       GList *configs)
 {
-  g_debug ("grl_fake_metadata_source_plugin_init");
+  GRL_LOG_DOMAIN_INIT (fake_metadata_log_domain, "fake-metadata");
+
+  GRL_DEBUG ("grl_fake_metadata_source_plugin_init");
+
   GrlFakeMetadataSource *source = grl_fake_metadata_source_new ();
   grl_plugin_registry_register_source (registry,
                                        plugin,
@@ -86,7 +89,7 @@ GRL_PLUGIN_REGISTER (grl_fake_metadata_source_plugin_init,
 static GrlFakeMetadataSource *
 grl_fake_metadata_source_new (void)
 {
-  g_debug ("grl_fake_metadata_source_new");
+  GRL_DEBUG ("grl_fake_metadata_source_new");
   return g_object_new (GRL_FAKE_METADATA_SOURCE_TYPE,
 		       "source-id", SOURCE_ID,
 		       "source-name", SOURCE_NAME,
@@ -204,7 +207,7 @@ static void
 grl_fake_metadata_source_resolve (GrlMetadataSource *source,
                                   GrlMetadataSourceResolveSpec *rs)
 {
-  g_debug ("grl_fake_metadata_source_resolve");
+  GRL_DEBUG ("grl_fake_metadata_source_resolve");
 
   GList *iter;
 
@@ -221,7 +224,7 @@ static void
 grl_fake_metadata_source_set_metadata (GrlMetadataSource *source,
 				       GrlMetadataSourceSetMetadataSpec *sms)
 {
-  g_debug ("grl_fake_metadata_source_set_metadata");
-  g_debug ("  Faking set metadata for %d keys!", g_list_length (sms->keys));
+  GRL_DEBUG ("grl_fake_metadata_source_set_metadata");
+  GRL_DEBUG ("  Faking set metadata for %d keys!", g_list_length (sms->keys));
   sms->callback (sms->source, sms->media, NULL, sms->user_data, NULL);
 }
diff --git a/src/filesystem/grl-filesystem.c b/src/filesystem/grl-filesystem.c
index 068a7de..7f58405 100644
--- a/src/filesystem/grl-filesystem.c
+++ b/src/filesystem/grl-filesystem.c
@@ -33,8 +33,8 @@
 
 /* --------- Logging  -------- */
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "grl-filesystem"
+#define GRL_LOG_DOMAIN_DEFAULT filesystem_log_domain
+GRL_LOG_DOMAIN_STATIC(filesystem_log_domain);
 
 /* -------- File info ------- */
 
@@ -113,7 +113,9 @@ grl_filesystem_plugin_init (GrlPluginRegistry *registry,
   GrlConfig *config;
   GList *chosen_paths = NULL;
 
-  g_debug ("filesystem_plugin_init\n");
+  GRL_LOG_DOMAIN_INIT (filesystem_log_domain, "filesystem");
+
+  GRL_DEBUG ("filesystem_plugin_init");
 
   GrlFilesystemSource *source = grl_filesystem_source_new ();
   grl_plugin_registry_register_source (registry,
@@ -148,7 +150,7 @@ G_DEFINE_TYPE (GrlFilesystemSource,
 static GrlFilesystemSource *
 grl_filesystem_source_new (void)
 {
-  g_debug ("grl_filesystem_source_new");
+  GRL_DEBUG ("grl_filesystem_source_new");
   return g_object_new (GRL_FILESYSTEM_SOURCE_TYPE,
 		       "source-id", SOURCE_ID,
 		       "source-name", SOURCE_NAME,
@@ -239,8 +241,8 @@ file_is_valid_content (const gchar *path, gboolean fast)
   file = g_file_new_for_path (path);
   info = g_file_query_info (file, spec, 0, NULL, &error);
   if (error) {
-    g_warning ("Failed to get attributes for file '%s': %s",
-	       path, error->message);
+    GRL_WARNING ("Failed to get attributes for file '%s': %s",
+                 path, error->message);
     g_error_free (error);
     g_object_unref (file);
     return FALSE;
@@ -279,10 +281,10 @@ set_container_childcount (const gchar *path,
   const gchar *entry_name;
 
   /* Open directory */
-  g_debug ("Opening directory '%s' for childcount", path);
+  GRL_DEBUG ("Opening directory '%s' for childcount", path);
   dir = g_dir_open (path, 0, &error);
   if (error) {
-    g_warning ("Failed to open directory '%s': %s", path, error->message);
+    GRL_WARNING ("Failed to open directory '%s': %s", path, error->message);
     g_error_free (error);
     return;
   }
@@ -339,7 +341,8 @@ create_content (GrlMedia *content,
   }
 
   if (error) {
-    g_warning ("Failed to get info for file '%s': %s", path, error->message);
+    GRL_WARNING ("Failed to get info for file '%s': %s", path,
+                 error->message);
     if (!media) {
       media = grl_media_new ();
     }
@@ -429,7 +432,7 @@ browse_emit_idle (gpointer user_data)
   BrowseIdleData *idle_data;
   guint count;
 
-  g_debug ("browse_emit_idle");
+  GRL_DEBUG ("browse_emit_idle");
 
   idle_data = (BrowseIdleData *) user_data;
 
@@ -476,10 +479,10 @@ produce_from_path (GrlMediaSourceBrowseSpec *bs, const gchar *path)
   GList *iter;
 
   /* Open directory */
-  g_debug ("Opening directory '%s'", path);
+  GRL_DEBUG ("Opening directory '%s'", path);
   dir = g_dir_open (path, 0, &error);
   if (error) {
-    g_warning ("Failed to open directory '%s': %s", path, error->message);
+    GRL_WARNING ("Failed to open directory '%s': %s", path, error->message);
     bs->callback (bs->source, bs->browse_id, NULL, 0, bs->user_data, error);
     g_error_free (error);
     return;
@@ -572,7 +575,7 @@ grl_filesystem_source_browse (GrlMediaSource *source,
   const gchar *id;
   GList *chosen_paths;
 
-  g_debug ("grl_filesystem_source_browse");
+  GRL_DEBUG ("grl_filesystem_source_browse");
 
   id = grl_media_get_id (bs->container);
   chosen_paths = GRL_FILESYSTEM_SOURCE(source)->priv->chosen_paths;
@@ -608,7 +611,7 @@ grl_filesystem_source_metadata (GrlMediaSource *source,
   const gchar *path;
   const gchar *id;
 
-  g_debug ("grl_filesystem_source_metadata");
+  GRL_DEBUG ("grl_filesystem_source_metadata");
 
   id = grl_media_get_id (ms->media);
   path = id ? id : G_DIR_SEPARATOR_S;
diff --git a/src/flickr/gflickr.c b/src/flickr/gflickr.c
index 30d041e..9a51a68 100644
--- a/src/flickr/gflickr.c
+++ b/src/flickr/gflickr.c
@@ -1,15 +1,21 @@
 #include "gflickr.h"
+#include "grl-flickr.h"       /* log domain */
 
 #include <libxml/parser.h>
 #include <libxml/xpath.h>
 #include <gio/gio.h>
 #include <string.h>
 
+#include <grilo.h>
+
+
 #define G_FLICKR_GET_PRIVATE(object)            \
   (G_TYPE_INSTANCE_GET_PRIVATE((object),        \
                                G_FLICKR_TYPE,   \
                                GFlickrPrivate))
 
+#define GRL_LOG_DOMAIN_DEFAULT flickr_log_domain
+
 #define FLICKR_PHOTO_ORIG_URL                           \
   "http://farm%s.static.flickr.com/%s/%s_%s_o.%s";
 
@@ -589,7 +595,7 @@ read_url_async (const gchar *url, gpointer data)
   GFile *uri;
 
   vfs = g_vfs_get_default ();
-  g_debug ("Opening '%s'", url);
+  GRL_DEBUG ("Opening '%s'", url);
   uri = g_vfs_get_file_for_uri (vfs, url);
   g_file_load_contents_async (uri, NULL, read_done_cb, data);
 }
@@ -990,7 +996,7 @@ g_flickr_auth_getFrob (GFlickr *f)
   uri = g_vfs_get_file_for_uri (vfs, url);
   g_free (url);
   if (!g_file_load_contents (uri, NULL, &contents, NULL, NULL, &error)) {
-    g_warning ("Unable to get Flickr's frob: %s", error->message);
+    GRL_WARNING ("Unable to get Flickr's frob: %s", error->message);
     return NULL;
   }
 
@@ -998,7 +1004,7 @@ g_flickr_auth_getFrob (GFlickr *f)
   frob = get_xpath_element (contents, "/rsp/frob");
   g_free (contents);
   if (!frob) {
-    g_warning ("Can not get Flickr's frob");
+    GRL_WARNING ("Can not get Flickr's frob");
   }
 
   return frob;
@@ -1065,7 +1071,7 @@ g_flickr_auth_getToken (GFlickr *f,
   uri = g_vfs_get_file_for_uri (vfs, url);
   g_free (url);
   if (!g_file_load_contents (uri, NULL, &contents, NULL, NULL, &error)) {
-    g_warning ("Unable to get Flickr's token: %s", error->message);
+    GRL_WARNING ("Unable to get Flickr's token: %s", error->message);
     return NULL;
   }
 
@@ -1073,7 +1079,7 @@ g_flickr_auth_getToken (GFlickr *f,
   token = get_xpath_element (contents, "/rsp/auth/token");
   g_free (contents);
   if (!token) {
-    g_warning ("Can not get Flickr's token");
+    GRL_WARNING ("Can not get Flickr's token");
   }
 
   return token;
diff --git a/src/flickr/grl-flickr.c b/src/flickr/grl-flickr.c
index b4341c2..fe28597 100644
--- a/src/flickr/grl-flickr.c
+++ b/src/flickr/grl-flickr.c
@@ -40,8 +40,8 @@
 
 /* --------- Logging  -------- */
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "grl-flickr"
+#define GRL_LOG_DOMAIN_DEFAULT flickr_log_domain
+GRL_LOG_DOMAIN(flickr_log_domain);
 
 #define SEARCH_MAX  500
 #define HOTLIST_MAX 200
@@ -123,10 +123,12 @@ grl_flickr_plugin_init (GrlPluginRegistry *registry,
   GrlConfig *config;
   gboolean public_source_created = FALSE;
 
-  g_debug ("flickr_plugin_init\n");
+  GRL_LOG_DOMAIN_INIT (flickr_log_domain, "flickr");
+
+  GRL_DEBUG ("flickr_plugin_init");
 
   if (!configs) {
-    g_warning ("Missing configuration");
+    GRL_WARNING ("Missing configuration");
     return FALSE;
   }
 
@@ -138,14 +140,14 @@ grl_flickr_plugin_init (GrlPluginRegistry *registry,
     flickr_secret = grl_config_get_api_secret (config);
 
     if (!flickr_key || !flickr_secret) {
-      g_warning ("Required configuration keys not set up");
+      GRL_WARNING ("Required configuration keys not set up");
     } else if (flickr_token) {
       grl_flickr_source_personal_new (plugin,
                                       flickr_key,
                                       flickr_secret,
                                       flickr_token);
     } else if (public_source_created) {
-      g_warning ("Only one public source can be created");
+      GRL_WARNING ("Only one public source can be created");
     } else {
       GrlFlickrSource *source = grl_flickr_source_public_new (flickr_key, flickr_secret);
       public_source_created = TRUE;
@@ -174,7 +176,7 @@ grl_flickr_source_public_new (const gchar *flickr_api_key,
 {
   GrlFlickrSource *source;
 
-  g_debug ("grl_flickr_source_new");
+  GRL_DEBUG ("grl_flickr_source_new");
 
   source = g_object_new (GRL_FLICKR_SOURCE_TYPE,
                          "source-id", PUBLIC_SOURCE_ID,
@@ -228,7 +230,7 @@ grl_flickr_source_finalize (GObject *object)
 {
   GrlFlickrSource *source;
 
-  g_debug ("grl_flickr_source_finalize");
+  GRL_DEBUG ("grl_flickr_source_finalize");
 
   source = GRL_FLICKR_SOURCE (object);
   g_free (source->priv->user_id);
@@ -253,7 +255,7 @@ token_info_cb (GFlickr *f,
   gchar *username;
 
   if (!info) {
-    g_warning ("Wrong token!");
+    GRL_WARNING ("Wrong token!");
     g_object_unref (f);
     return;
   }
@@ -269,8 +271,8 @@ token_info_cb (GFlickr *f,
 
   /* Check if source is already registered */
   if (grl_plugin_registry_lookup_source (registry, source_id)) {
-    g_debug ("A source with id '%s' is already registered. Skipping...",
-             source_id);
+    GRL_DEBUG ("A source with id '%s' is already registered. Skipping...",
+               source_id);
     g_object_unref (f);
   } else {
     source = g_object_new (GRL_FLICKR_SOURCE_TYPE,
diff --git a/src/flickr/grl-flickr.h b/src/flickr/grl-flickr.h
index 2b9309f..af1a843 100644
--- a/src/flickr/grl-flickr.h
+++ b/src/flickr/grl-flickr.h
@@ -53,6 +53,9 @@
                               GRL_FLICKR_SOURCE_TYPE,   \
                               GrlFlickrSourceClass))
 
+/* plugin's log domain */
+GRL_LOG_DOMAIN_EXTERN(flickr_log_domain);
+
 typedef struct _GrlFlickrSource        GrlFlickrSource;
 typedef struct _GrlFlickrSourcePrivate GrlFlickrSourcePrivate;
 
diff --git a/src/gravatar/grl-gravatar.c b/src/gravatar/grl-gravatar.c
index ac90fa7..976756d 100644
--- a/src/gravatar/grl-gravatar.c
+++ b/src/gravatar/grl-gravatar.c
@@ -30,8 +30,8 @@
 
 /* ---------- Logging ---------- */
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "grl-gravatar"
+#define GRL_LOG_DOMAIN_DEFAULT gravatar_log_domain
+GRL_LOG_DOMAIN_STATIC(gravatar_log_domain);
 
 /* -------- Gravatar API -------- */
 
@@ -79,7 +79,10 @@ grl_gravatar_source_plugin_init (GrlPluginRegistry *registry,
                                  const GrlPluginInfo *plugin,
                                  GList *configs)
 {
-  g_debug ("grl_gravatar_source_plugin_init");
+  GRL_LOG_DOMAIN_INIT (gravatar_log_domain, "gravatar");
+
+  GRL_DEBUG ("grl_gravatar_source_plugin_init");
+
   /* Register keys */
   GRL_METADATA_KEY_ARTIST_AVATAR =
     register_gravatar_key (registry,
@@ -94,7 +97,7 @@ grl_gravatar_source_plugin_init (GrlPluginRegistry *registry,
                             "Avatar for the author");
   if (!GRL_METADATA_KEY_ARTIST_AVATAR &&
       !GRL_METADATA_KEY_AUTHOR_AVATAR) {
-    g_warning ("Unable to register \"autor-avatar\" nor \"artist-avatar\"");
+    GRL_WARNING ("Unable to register \"autor-avatar\" nor \"artist-avatar\"");
     return FALSE;
   }
 
@@ -114,7 +117,7 @@ GRL_PLUGIN_REGISTER (grl_gravatar_source_plugin_init,
 static GrlGravatarSource *
 grl_gravatar_source_new (void)
 {
-  g_debug ("grl_gravatar_source_new");
+  GRL_DEBUG ("grl_gravatar_source_new");
   return g_object_new (GRL_GRAVATAR_SOURCE_TYPE,
 		       "source-id", SOURCE_ID,
 		       "source-name", SOURCE_NAME,
@@ -256,7 +259,7 @@ grl_gravatar_source_resolve (GrlMetadataSource *source,
   gboolean author_avatar_required = FALSE;
   gchar *avatar_url;
 
-  g_debug ("grl_gravatar_source_resolve");
+  GRL_DEBUG ("grl_gravatar_source_resolve");
 
   GList *iter;
 
diff --git a/src/jamendo/grl-jamendo.c b/src/jamendo/grl-jamendo.c
index e1943bb..7a58400 100644
--- a/src/jamendo/grl-jamendo.c
+++ b/src/jamendo/grl-jamendo.c
@@ -37,8 +37,8 @@
 
 /* --------- Logging  -------- */
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "grl-jamendo"
+#define GRL_LOG_DOMAIN_DEFAULT jamendo_log_domain
+GRL_LOG_DOMAIN_STATIC(jamendo_log_domain);
 
 #define JAMENDO_ID_SEP    "/"
 #define JAMENDO_ROOT_NAME "Jamendo"
@@ -190,7 +190,9 @@ grl_jamendo_plugin_init (GrlPluginRegistry *registry,
                          const GrlPluginInfo *plugin,
                          GList *configs)
 {
-  g_debug ("jamendo_plugin_init\n");
+  GRL_LOG_DOMAIN_INIT (jamendo_log_domain, "jamendo");
+
+  GRL_DEBUG ("jamendo_plugin_init");
 
   GrlJamendoSource *source = grl_jamendo_source_new ();
   grl_plugin_registry_register_source (registry,
@@ -208,7 +210,7 @@ GRL_PLUGIN_REGISTER (grl_jamendo_plugin_init,
 static GrlJamendoSource *
 grl_jamendo_source_new (void)
 {
-  g_debug ("grl_jamendo_source_new");
+  GRL_DEBUG ("grl_jamendo_source_new");
   return g_object_new (GRL_JAMENDO_SOURCE_TYPE,
 		       "source-id", SOURCE_ID,
 		       "source-name", SOURCE_NAME,
@@ -553,7 +555,7 @@ xml_parse_entries_idle (gpointer user_data)
   Entry *entry;
   gint remaining = 0;
 
-  g_debug ("xml_parse_entries_idle");
+  GRL_DEBUG ("xml_parse_entries_idle");
 
   parse_more = (xpe->cancelled == FALSE && xpe->node);
 
@@ -737,7 +739,7 @@ read_url_async (const gchar *url, gpointer user_data)
 
   vfs = g_vfs_get_default ();
 
-  g_debug ("Opening '%s'", url);
+  GRL_DEBUG ("Opening '%s'", url);
   uri = g_vfs_get_file_for_uri (vfs, url);
   g_file_load_contents_async (uri, NULL, read_done_cb, user_data);
 }
@@ -933,7 +935,7 @@ grl_jamendo_source_metadata (GrlMediaSource *source,
   GError *error = NULL;
   JamendoCategory category;
 
-  g_debug ("grl_jamendo_source_metadata");
+  GRL_DEBUG ("grl_jamendo_source_metadata");
 
   if (!ms->media ||
       !grl_data_key_is_known (GRL_DATA (ms->media),
@@ -1057,7 +1059,7 @@ grl_jamendo_source_browse (GrlMediaSource *source,
   guint page_number;
   guint page_offset;
 
-  g_debug ("grl_jamendo_source_browse");
+  GRL_DEBUG ("grl_jamendo_source_browse");
 
   container_id = grl_media_get_id (bs->container);
 
@@ -1196,7 +1198,7 @@ grl_jamendo_source_query (GrlMediaSource *source,
   guint page_number;
   guint page_offset;
 
-  g_debug ("grl_jamendo_source_query");
+  GRL_DEBUG ("grl_jamendo_source_query");
 
   if (!parse_query (qs->query, &category, &term)) {
     error = g_error_new (GRL_CORE_ERROR,
@@ -1264,7 +1266,7 @@ grl_jamendo_source_search (GrlMediaSource *source,
   guint page_number;
   guint page_offset;
 
-  g_debug ("grl_jamendo_source_search");
+  GRL_DEBUG ("grl_jamendo_source_search");
 
   jamendo_keys = get_jamendo_keys (JAMENDO_TRACK_CAT);
 
@@ -1297,7 +1299,7 @@ grl_jamendo_source_cancel (GrlMediaSource *source, guint operation_id)
 {
   XmlParseEntries *xpe;
 
-  g_debug ("grl_jamendo_source_cancel");
+  GRL_DEBUG ("grl_jamendo_source_cancel");
 
   xpe = (XmlParseEntries *) grl_media_source_get_operation_data (source,
                                                                  operation_id);
diff --git a/src/lastfm-albumart/grl-lastfm-albumart.c b/src/lastfm-albumart/grl-lastfm-albumart.c
index 2afa847..c448177 100644
--- a/src/lastfm-albumart/grl-lastfm-albumart.c
+++ b/src/lastfm-albumart/grl-lastfm-albumart.c
@@ -35,8 +35,8 @@
 
 /* ---------- Logging ---------- */
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "grl-lastfm-albumart"
+#define GRL_LOG_DOMAIN_DEFAULT lastfm_albumart_log_domain
+GRL_LOG_DOMAIN_STATIC(lastfm_albumart_log_domain);
 
 /* -------- Last.FM API -------- */
 
@@ -78,7 +78,10 @@ grl_lastfm_albumart_source_plugin_init (GrlPluginRegistry *registry,
                                         const GrlPluginInfo *plugin,
                                         GList *configs)
 {
-  g_debug ("grl_lastfm_albumart_source_plugin_init");
+  GRL_LOG_DOMAIN_INIT (lastfm_albumart_log_domain, "lastfm-albumart");
+
+  GRL_DEBUG ("grl_lastfm_albumart_source_plugin_init");
+
   GrlLastfmAlbumartSource *source = grl_lastfm_albumart_source_new ();
   grl_plugin_registry_register_source (registry,
                                        plugin,
@@ -95,7 +98,7 @@ GRL_PLUGIN_REGISTER (grl_lastfm_albumart_source_plugin_init,
 static GrlLastfmAlbumartSource *
 grl_lastfm_albumart_source_new (void)
 {
-  g_debug ("grl_lastfm_albumart_source_new");
+  GRL_DEBUG ("grl_lastfm_albumart_source_new");
   return g_object_new (GRL_LASTFM_ALBUMART_SOURCE_TYPE,
 		       "source-id", SOURCE_ID,
 		       "source-name", SOURCE_NAME,
@@ -214,7 +217,7 @@ read_url_async (const gchar *url, gpointer user_data)
 
   vfs = g_vfs_get_default ();
 
-  g_debug ("Opening '%s'", url);
+  GRL_DEBUG ("Opening '%s'", url);
   uri = g_vfs_get_file_for_uri (vfs, url);
   g_file_load_contents_async (uri, NULL, read_done_cb, user_data);
 }
@@ -263,7 +266,7 @@ grl_lastfm_albumart_source_resolve (GrlMetadataSource *source,
   gchar *esc_album = NULL;
   gchar *url = NULL;
 
-  g_debug ("grl_lastfm_albumart_source_resolve");
+  GRL_DEBUG ("grl_lastfm_albumart_source_resolve");
 
   GList *iter;
 
@@ -278,7 +281,7 @@ grl_lastfm_albumart_source_resolve (GrlMetadataSource *source,
   }
 
   if (iter == NULL) {
-    g_debug ("No supported key was requested");
+    GRL_DEBUG ("No supported key was requested");
     rs->callback (source, rs->media, rs->user_data, NULL);
   } else {
     artist = grl_data_get_string (GRL_DATA (rs->media),
@@ -288,7 +291,7 @@ grl_lastfm_albumart_source_resolve (GrlMetadataSource *source,
                                  GRL_METADATA_KEY_ALBUM);
 
     if (!artist || !album) {
-      g_debug ("Missing dependencies");
+      GRL_DEBUG ("Missing dependencies");
       rs->callback (source, rs->media, rs->user_data, NULL);
     } else {
       esc_artist = g_uri_escape_string (artist, NULL, TRUE);
diff --git a/src/metadata-store/grl-metadata-store.c b/src/metadata-store/grl-metadata-store.c
index 691093f..c672174 100644
--- a/src/metadata-store/grl-metadata-store.c
+++ b/src/metadata-store/grl-metadata-store.c
@@ -35,8 +35,8 @@
                                GRL_METADATA_STORE_SOURCE_TYPE,	 \
                                GrlMetadataStorePrivate))
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "grl-metadata-store"
+#define GRL_LOG_DOMAIN_DEFAULT metadata_store_log_domain
+GRL_LOG_DOMAIN_STATIC(metadata_store_log_domain);
 
 #define PLUGIN_ID   METADATA_STORE_PLUGIN_ID
 
@@ -112,7 +112,10 @@ grl_metadata_store_source_plugin_init (GrlPluginRegistry *registry,
                                       const GrlPluginInfo *plugin,
                                       GList *configs)
 {
-  g_debug ("grl_metadata_store_source_plugin_init");
+  GRL_LOG_DOMAIN_INIT (metadata_store_log_domain, "metadata-store");
+
+  GRL_DEBUG ("grl_metadata_store_source_plugin_init");
+
   GrlMetadataStoreSource *source = grl_metadata_store_source_new ();
   grl_plugin_registry_register_source (registry,
                                        plugin,
@@ -129,7 +132,7 @@ GRL_PLUGIN_REGISTER (grl_metadata_store_source_plugin_init,
 static GrlMetadataStoreSource *
 grl_metadata_store_source_new (void)
 {
-  g_debug ("grl_metadata_store_source_new");
+  GRL_DEBUG ("grl_metadata_store_source_new");
   return g_object_new (GRL_METADATA_STORE_SOURCE_TYPE,
 		       "source-id", SOURCE_ID,
 		       "source-name", SOURCE_NAME,
@@ -162,11 +165,11 @@ grl_metadata_store_source_init (GrlMetadataStoreSource *source)
 
   home = g_getenv ("HOME");
   if (!home) {
-    g_warning ("$HOME not set, cannot open database");
+    GRL_WARNING ("$HOME not set, cannot open database");
     return;
   }
 
-  g_debug ("Opening database connection...");
+  GRL_DEBUG ("Opening database connection...");
   db_path = g_strconcat (home, G_DIR_SEPARATOR_S, GRL_SQL_DB, NULL);
   r = sqlite3_open (db_path, &source->priv->db);
   if (r) {
@@ -175,24 +178,24 @@ grl_metadata_store_source_init (GrlMetadataStoreSource *source)
     sqlite3_close (source->priv->db);
     return;
   }
-  g_debug ("  OK");
+  GRL_DEBUG ("  OK");
 
-  g_debug ("Checking database tables...");
+  GRL_DEBUG ("Checking database tables...");
   r = sqlite3_exec (source->priv->db, GRL_SQL_CREATE_TABLE_STORE,
 		    NULL, NULL, &sql_error);
 
   if (r) {
     if (sql_error) {
-      g_warning ("Failed to create database tables: %s", sql_error);
+      GRL_WARNING ("Failed to create database tables: %s", sql_error);
       sqlite3_free (sql_error);
       sql_error = NULL;
     } else {
-      g_warning ("Failed to create database tables.");
+      GRL_WARNING ("Failed to create database tables.");
     }
     sqlite3_close (source->priv->db);
     return;
   }
-  g_debug ("  OK");
+  GRL_DEBUG ("  OK");
 
   g_free (db_path);
 }
@@ -211,15 +214,15 @@ query_metadata_store (sqlite3 *db,
   sqlite3_stmt *sql_stmt = NULL;
   gchar *sql;
 
-  g_debug ("get_metadata");
+  GRL_DEBUG ("get_metadata");
 
   sql = g_strdup_printf (GRL_SQL_GET_METADATA, source_id, media_id);
-  g_debug ("%s", sql);
+  GRL_DEBUG ("%s", sql);
   r = sqlite3_prepare_v2 (db, sql, strlen (sql), &sql_stmt, NULL);
   g_free (sql);
 
   if (r != SQLITE_OK) {
-    g_warning ("Failed to get metadata: %s", sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to get metadata: %s", sqlite3_errmsg (db));
     return NULL;
   }
 
@@ -300,12 +303,12 @@ bind_and_exec (sqlite3 *db,
   sqlite3_stmt *stmt;
 
   /* Create statement from sql */
-  g_debug ("%s", sql);
+  GRL_DEBUG ("%s", sql);
   r = sqlite3_prepare_v2 (db, sql, strlen (sql), &stmt, NULL);
 
   if (r != SQLITE_OK) {
-    g_warning ("Failed to update metadata for '%s - %s': %s",
-	       source_id, media_id, sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to update metadata for '%s - %s': %s",
+                     source_id, media_id, sqlite3_errmsg (db));
     sqlite3_finalize (stmt);
     return FALSE;
   }
@@ -361,7 +364,7 @@ prepare_and_exec_update (sqlite3 *db,
   gchar *sql_set;
   guint count;
 
-  g_debug ("prepare_and_exec_update");
+  GRL_DEBUG ("prepare_and_exec_update");
 
   /* Prepare sql "set" for update query */
   count = 0;
@@ -403,7 +406,7 @@ prepare_and_exec_insert (sqlite3 *db,
   GString *sql_buf_cols, *sql_buf_values;
   gchar *sql_cols, *sql_values;
 
-  g_debug ("prepare_and_exec_insert");
+  GRL_DEBUG ("prepare_and_exec_insert");
 
   /* Prepare sql for insert query */
   sql_buf_cols = g_string_new ("");
@@ -448,7 +451,8 @@ write_keys (sqlite3 *db,
   while (iter) {
     const gchar *col_name = get_column_name_from_key_id (iter->data);
     if (!col_name) {
-      g_warning ("Key %" GRL_KEYID_FORMAT " is not supported for writing, ignoring...",
+      GRL_WARNING ("Key %" GRL_KEYID_FORMAT " is not supported for "
+                       "writing, ignoring...",
                  iter->data);
       failed_keys = g_list_prepend (failed_keys, iter->data);
     } else {
@@ -460,8 +464,8 @@ write_keys (sqlite3 *db,
   col_names = g_list_reverse (col_names);
 
   if (supported_keys == 0) {
-    g_warning ("Failed to update metadata, none of the specified "
-	       "keys is writable");
+    GRL_WARNING ("Failed to update metadata, none of the specified "
+                     "keys is writable");
     *error = g_error_new (GRL_CORE_ERROR,
 			  GRL_CORE_ERROR_SET_METADATA_FAILED,
 			  "Failed to update metadata, "
@@ -477,8 +481,8 @@ write_keys (sqlite3 *db,
 			       sms->media);
     
   if (!r) {
-    g_warning ("Failed to update metadata for '%s - %s': %s",
-	       source_id, media_id, sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to update metadata for '%s - %s': %s",
+                     source_id, media_id, sqlite3_errmsg (db));
     g_list_free (failed_keys);
     failed_keys = g_list_copy (sms->keys);
     *error = g_error_new (GRL_CORE_ERROR,
@@ -498,8 +502,8 @@ write_keys (sqlite3 *db,
   }
 
   if (!r) {
-    g_warning ("Failed to update metadata for '%s - %s': %s",
-	       source_id, media_id, sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to update metadata for '%s - %s': %s",
+                     source_id, media_id, sqlite3_errmsg (db));
     g_list_free (failed_keys);
     failed_keys = g_list_copy (sms->keys);
     *error = g_error_new (GRL_CORE_ERROR,
@@ -566,7 +570,7 @@ static void
 grl_metadata_store_source_resolve (GrlMetadataSource *source,
 				   GrlMetadataSourceResolveSpec *rs)
 {
-  g_debug ("grl_metadata_store_source_resolve");
+  GRL_DEBUG ("grl_metadata_store_source_resolve");
 
   const gchar *source_id, *media_id;
   sqlite3_stmt *stmt;
@@ -577,7 +581,7 @@ grl_metadata_store_source_resolve (GrlMetadataSource *source,
 
   /* We need the source id */
   if (!source_id) {
-    g_warning ("Failed to resolve metadata: source-id not available");
+    GRL_WARNING ("Failed to resolve metadata: source-id not available");
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_RESOLVE_FAILED,
 			 "source-id not available, cannot resolve metadata.");
@@ -597,7 +601,7 @@ grl_metadata_store_source_resolve (GrlMetadataSource *source,
     fill_metadata (rs->media, rs->keys, stmt);
     rs->callback (rs->source, rs->media, rs->user_data, NULL);
   } else {
-    g_warning ("Failed to resolve metadata");
+    GRL_WARNING ("Failed to resolve metadata");
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_RESOLVE_FAILED,
 			 "Failed to resolve metadata.");
@@ -610,7 +614,7 @@ static void
 grl_metadata_store_source_set_metadata (GrlMetadataSource *source,
 					GrlMetadataSourceSetMetadataSpec *sms)
 {
-  g_debug ("grl_metadata_store_source_set_metadata");
+  GRL_DEBUG ("grl_metadata_store_source_set_metadata");
 
   const gchar *media_id, *source_id;
   GError *error = NULL;
@@ -621,7 +625,7 @@ grl_metadata_store_source_set_metadata (GrlMetadataSource *source,
 
   /* We need the source id */
   if (!source_id) {
-    g_warning ("Failed to update metadata: source-id not available");
+    GRL_WARNING ("Failed to update metadata: source-id not available");
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_SET_METADATA_FAILED,
 			 "source-id not available, cannot update metadata.");
diff --git a/src/podcasts/grl-podcasts.c b/src/podcasts/grl-podcasts.c
index 53bd08e..74629f2 100644
--- a/src/podcasts/grl-podcasts.c
+++ b/src/podcasts/grl-podcasts.c
@@ -43,8 +43,8 @@
 
 /* --------- Logging  -------- */
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "grl-podcasts"
+#define GRL_LOG_DOMAIN_DEFAULT podcasts_log_domain
+GRL_LOG_DOMAIN_STATIC(podcasts_log_domain);
 
 /* --- Database --- */
 
@@ -239,7 +239,9 @@ grl_podcasts_plugin_init (GrlPluginRegistry *registry,
                           const GrlPluginInfo *plugin,
                           GList *configs)
 {
-  g_debug ("podcasts_plugin_init\n");
+  GRL_LOG_DOMAIN_INIT (podcasts_log_domain, "pocasts");
+
+  GRL_DEBUG ("podcasts_plugin_init");
 
   GrlPodcastsSource *source = grl_podcasts_source_new ();
   grl_plugin_registry_register_source (registry,
@@ -257,7 +259,7 @@ GRL_PLUGIN_REGISTER (grl_podcasts_plugin_init,
 static GrlPodcastsSource *
 grl_podcasts_source_new (void)
 {
-  g_debug ("grl_podcasts_source_new");
+  GRL_DEBUG ("grl_podcasts_source_new");
   return g_object_new (GRL_PODCASTS_SOURCE_TYPE,
 		       "source-id", SOURCE_ID,
 		       "source-name", SOURCE_NAME,
@@ -298,11 +300,11 @@ grl_podcasts_source_init (GrlPodcastsSource *source)
 
   home = g_getenv ("HOME");
   if (!home) {
-    g_warning ("$HOME not set, cannot open database");
+    GRL_WARNING ("$HOME not set, cannot open database");
     return;
   }
 
-  g_debug ("Opening database connection...");
+  GRL_DEBUG ("Opening database connection...");
   db_path = g_strconcat (home, G_DIR_SEPARATOR_S, GRL_SQL_DB, NULL);
   r = sqlite3_open (db_path, &source->priv->db);
   if (r) {
@@ -311,9 +313,9 @@ grl_podcasts_source_init (GrlPodcastsSource *source)
     sqlite3_close (source->priv->db);
     return;
   }
-  g_debug ("  OK");
+  GRL_DEBUG ("  OK");
 
-  g_debug ("Checking database tables...");
+  GRL_DEBUG ("Checking database tables...");
   r = sqlite3_exec (source->priv->db, GRL_SQL_CREATE_TABLE_PODCASTS,
 		    NULL, NULL, &sql_error);
 
@@ -324,16 +326,16 @@ grl_podcasts_source_init (GrlPodcastsSource *source)
   }
   if (r) {
     if (sql_error) {
-      g_warning ("Failed to create database tables: %s", sql_error);
+      GRL_WARNING ("Failed to create database tables: %s", sql_error);
       sqlite3_free (sql_error);
       sql_error = NULL;
     } else {
-      g_warning ("Failed to create database tables.");
+      GRL_WARNING ("Failed to create database tables.");
     }
     sqlite3_close (source->priv->db);
     return;
   }
-  g_debug ("  OK");
+  GRL_DEBUG ("  OK");
 
   g_free (db_path);
 }
@@ -345,7 +347,7 @@ grl_podcasts_source_finalize (GObject *object)
 {
   GrlPodcastsSource *source;
 
-  g_debug ("grl_podcasts_source_finalize");
+  GRL_DEBUG ("grl_podcasts_source_finalize");
 
   source = GRL_PODCASTS_SOURCE (object);
 
@@ -389,7 +391,7 @@ read_done_cb (GObject *source_object,
   GError *vfs_error = NULL;
   gchar *content = NULL;
 
-  g_debug ("  Done");
+  GRL_DEBUG ("  Done");
 
   g_file_load_contents_finish (G_FILE (source_object),
                                res,
@@ -399,7 +401,7 @@ read_done_cb (GObject *source_object,
                                &vfs_error);
   g_object_unref (source_object);
   if (vfs_error) {
-    g_warning ("Failed to open '%s': %s", arc->url, vfs_error->message);
+    GRL_WARNING ("Failed to open '%s': %s", arc->url, vfs_error->message);
     g_error_free (vfs_error);
   } else {
     arc->callback (content, arc->user_data);
@@ -419,7 +421,7 @@ read_url_async (const gchar *url,
 
   vfs = g_vfs_get_default ();
 
-  g_debug ("Opening async '%s'", url);
+  GRL_DEBUG ("Opening async '%s'", url);
 
   arc = g_slice_new0 (AsyncReadCb);
   arc->url = g_strdup (url);
@@ -623,17 +625,17 @@ produce_podcast_contents_from_db (OperationSpec *os)
   gint r;
   GError *error = NULL;
 
-  g_debug ("produce_podcast_contents_from_db");
+  GRL_DEBUG ("produce_podcast_contents_from_db");
 
   db = GRL_PODCASTS_SOURCE (os->source)->priv->db;
   sql = g_strdup_printf (GRL_SQL_GET_PODCAST_STREAMS,
 			 os->media_id, os->count, os->skip);
-  g_debug ("%s", sql);
+  GRL_DEBUG ("%s", sql);
   r = sqlite3_prepare_v2 (db, sql, strlen (sql), &sql_stmt, NULL);
   g_free (sql);
 
   if (r != SQLITE_OK) {
-    g_warning ("Failed to retrieve podcast streams: %s", sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to retrieve podcast streams: %s", sqlite3_errmsg (db));
     error = g_error_new (GRL_CORE_ERROR,
 			 os->error_code,
 			 "Failed to retrieve podcast streams");
@@ -652,7 +654,7 @@ produce_podcast_contents_from_db (OperationSpec *os)
   }
 
   if (r != SQLITE_DONE) {
-    g_warning ("Failed to retrive podcast streams: %s", sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to retrive podcast streams: %s", sqlite3_errmsg (db));
     error = g_error_new (GRL_CORE_ERROR,
 			 os->error_code,
 			 "Failed to retrieve podcast streams");
@@ -691,11 +693,11 @@ remove_podcast_streams (sqlite3 *db, const gchar *podcast_id, GError **error)
   gint r;
 
   sql = g_strdup_printf (GRL_SQL_DELETE_PODCAST_STREAMS, podcast_id);
-  g_debug ("%s", sql);
+  GRL_DEBUG ("%s", sql);
   r = sqlite3_exec (db, sql, NULL, NULL, &sql_error);
   g_free (sql);
   if (r) {
-    g_warning ("Failed to remove podcast streams cache: %s", sql_error);
+    GRL_WARNING ("Failed to remove podcast streams cache: %s", sql_error);
     *error = g_error_new (GRL_CORE_ERROR,
 			  GRL_CORE_ERROR_REMOVE_FAILED,
 			  "Failed to remove podcast streams");
@@ -710,7 +712,7 @@ remove_podcast (sqlite3 *db, const gchar *podcast_id, GError **error)
   gchar *sql_error;
   gchar *sql;
 
-  g_debug ("remove_podcast");
+  GRL_DEBUG ("remove_podcast");
 
   remove_podcast_streams (db, podcast_id, error);
   if (*error) {
@@ -718,12 +720,12 @@ remove_podcast (sqlite3 *db, const gchar *podcast_id, GError **error)
   }
 
   sql = g_strdup_printf (GRL_SQL_REMOVE_PODCAST, podcast_id);
-  g_debug ("%s", sql);
+  GRL_DEBUG ("%s", sql);
   r = sqlite3_exec (db, sql, NULL, NULL, &sql_error);
   g_free (sql);
 
   if (r != SQLITE_OK) {
-    g_warning ("Failed to remove podcast '%s': %s", podcast_id, sql_error);
+    GRL_WARNING ("Failed to remove podcast '%s': %s", podcast_id, sql_error);
     *error = g_error_new (GRL_CORE_ERROR,
 			  GRL_CORE_ERROR_REMOVE_FAILED,
 			  "Failed to remove podcast");
@@ -738,15 +740,15 @@ remove_stream (sqlite3 *db, const gchar *url, GError **error)
   gchar *sql_error;
   gchar *sql;
 
-  g_debug ("remove_stream");
+  GRL_DEBUG ("remove_stream");
 
   sql = g_strdup_printf (GRL_SQL_REMOVE_STREAM, url);
-  g_debug ("%s", sql);
+  GRL_DEBUG ("%s", sql);
   r = sqlite3_exec (db, sql, NULL, NULL, &sql_error);
   g_free (sql);
 
   if (r != SQLITE_OK) {
-    g_warning ("Failed to remove podcast stream '%s': %s", url, sql_error);
+    GRL_WARNING ("Failed to remove podcast stream '%s': %s", url, sql_error);
     *error = g_error_new (GRL_CORE_ERROR,
 			  GRL_CORE_ERROR_REMOVE_FAILED,
 			  "Failed to remove podcast stream");
@@ -764,19 +766,20 @@ store_podcast (sqlite3 *db, GrlMedia *podcast, GError **error)
   const gchar *desc;
   gchar *id;
 
-  g_debug ("store_podcast");
+  GRL_DEBUG ("store_podcast");
 
   title = grl_media_get_title (podcast);
   url = grl_media_get_url (podcast);
   desc = grl_media_get_description (podcast);
 
-  g_debug ("%s", GRL_SQL_STORE_PODCAST);
+  GRL_DEBUG ("%s", GRL_SQL_STORE_PODCAST);
   r = sqlite3_prepare_v2 (db,
 			  GRL_SQL_STORE_PODCAST,
 			  strlen (GRL_SQL_STORE_PODCAST),
 			  &sql_stmt, NULL);
   if (r != SQLITE_OK) {
-    g_warning ("Failed to store podcast '%s': %s", title, sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to store podcast '%s': %s", title,
+                 sqlite3_errmsg (db));
     *error = g_error_new (GRL_CORE_ERROR,
 			  GRL_CORE_ERROR_STORE_FAILED,
 			  "Failed to store podcast '%s'", title);
@@ -794,7 +797,8 @@ store_podcast (sqlite3 *db, GrlMedia *podcast, GError **error)
   while ((r = sqlite3_step (sql_stmt)) == SQLITE_BUSY);
 
   if (r != SQLITE_DONE) {
-    g_warning ("Failed to store podcast '%s': %s", title, sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to store podcast '%s': %s", title,
+                 sqlite3_errmsg (db));
     *error = g_error_new (GRL_CORE_ERROR,
 			  GRL_CORE_ERROR_STORE_FAILED,
 			  "Failed to store podcast '%s'", title);
@@ -817,19 +821,19 @@ store_stream (sqlite3 *db, const gchar *podcast_id, Entry *entry)
   sqlite3_stmt *sql_stmt = NULL;
 
   if (!entry->url || entry->url[0] == '\0') {
-    g_debug ("Podcast stream has no URL, skipping");
+    GRL_DEBUG ("Podcast stream has no URL, skipping");
     return;
   }
 
   seconds = duration_to_seconds (entry->duration);
-  g_debug ("%s", GRL_SQL_STORE_STREAM);
+  GRL_DEBUG ("%s", GRL_SQL_STORE_STREAM);
   r = sqlite3_prepare_v2 (db,
 			  GRL_SQL_STORE_STREAM,
 			  strlen (GRL_SQL_STORE_STREAM),
 			  &sql_stmt, NULL);
   if (r != SQLITE_OK) {
-    g_warning ("Failed to store podcast stream '%s': %s",
-	       entry->url, sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to store podcast stream '%s': %s",
+                 entry->url, sqlite3_errmsg (db));
     return;
   }
 
@@ -844,8 +848,8 @@ store_stream (sqlite3 *db, const gchar *podcast_id, Entry *entry)
   while ((r = sqlite3_step (sql_stmt)) == SQLITE_BUSY);
 
   if (r != SQLITE_DONE) {
-    g_warning ("Failed to store podcast stream '%s': %s",
-	       entry->url, sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to store podcast stream '%s': %s",
+                 entry->url, sqlite3_errmsg (db));
   }
 
   sqlite3_finalize (sql_stmt);
@@ -886,18 +890,18 @@ touch_podcast (sqlite3 *db, const gchar *podcast_id)
   GTimeVal now;
   gchar *now_str;
 
-  g_debug ("touch_podcast");
+  GRL_DEBUG ("touch_podcast");
 
   g_get_current_time (&now);
   now_str = g_time_val_to_iso8601 (&now);
 
   sql = g_strdup_printf (GRL_SQL_TOUCH_PODCAST, now_str, podcast_id);
-  g_debug ("%s", sql);
+  GRL_DEBUG ("%s", sql);
   r = sqlite3_exec (db, sql, NULL, NULL, &sql_error);
   g_free (sql);
 
   if (r != SQLITE_OK) {
-    g_warning ("Failed to touch podcast, '%s': %s", podcast_id, sql_error);
+    GRL_WARNING ("Failed to touch podcast, '%s': %s", podcast_id, sql_error);
     sqlite3_free (sql_error);
     return;
   }
@@ -922,7 +926,7 @@ parse_entry_idle (gpointer user_data)
 
   /* Check if entry is valid */
   if (!entry->url || entry->url[0] == '\0') {
-    g_debug ("Podcast stream has no URL, skipping");
+    GRL_DEBUG ("Podcast stream has no URL, skipping");
   } else {
     /* Provide results to user as fast as possible */
     if (osp->parse_valid_index >= osp->os->skip &&
@@ -984,7 +988,7 @@ parse_feed (OperationSpec *os, const gchar *str, GError **error)
   xmlXPathObjectPtr xpathObj = NULL;
   guint stream_count;
 
-  g_debug ("parse_feed");
+  GRL_DEBUG ("parse_feed");
 
   doc = xmlParseDoc ((xmlChar *) str);
   if (!doc) {
@@ -1027,7 +1031,7 @@ parse_feed (OperationSpec *os, const gchar *str, GError **error)
 
   /* If the feed contains no streams, notify and bail out */
   stream_count = xpathObj->nodesetval ? xpathObj->nodesetval->nodeNr : 0;
-  g_debug ("Got %d streams", stream_count);
+  GRL_DEBUG ("Got %d streams", stream_count);
   
   if (stream_count <= 0) {
     os->callback (os->source,
@@ -1092,16 +1096,16 @@ get_podcast_info (sqlite3 *db, const gchar *podcast_id)
   sqlite3_stmt *sql_stmt = NULL;
   gchar *sql;
 
-  g_debug ("get_podcast_info");
+  GRL_DEBUG ("get_podcast_info");
 
   sql = g_strdup_printf (GRL_SQL_GET_PODCAST_BY_ID, podcast_id);
-  g_debug ("%s", sql);
+  GRL_DEBUG ("%s", sql);
   r = sqlite3_prepare_v2 (db, sql, strlen (sql), &sql_stmt, NULL);
   g_free (sql);
 
   if (r != SQLITE_OK) {
-    g_warning ("Failed to retrieve podcast '%s': %s",
-	       podcast_id, sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to retrieve podcast '%s': %s",
+                 podcast_id, sqlite3_errmsg (db));
     return NULL;
   }
 
@@ -1110,8 +1114,8 @@ get_podcast_info (sqlite3 *db, const gchar *podcast_id)
   if (r == SQLITE_ROW) {
     return sql_stmt;
   } else {
-    g_warning ("Failed to retrieve podcast information: %s",
-	       sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to retrieve podcast information: %s",
+                 sqlite3_errmsg (db));
     sqlite3_finalize (sql_stmt);
     return NULL;
   }
@@ -1125,7 +1129,7 @@ produce_podcast_contents (OperationSpec *os)
   GError *error;
   gchar *url;
 
-  g_debug ("produce_podcast_contents");
+  GRL_DEBUG ("produce_podcast_contents");
 
   /* First we get some information about the podcast */
   db = GRL_PODCASTS_SOURCE (os->source)->priv->db;
@@ -1137,13 +1141,13 @@ produce_podcast_contents (OperationSpec *os)
 
     /* Check if we have to refresh the podcast */
     lr_str = (gchar *) sqlite3_column_text (sql_stmt, PODCAST_LAST_REFRESHED);
-    g_debug ("Podcast last-refreshed: '%s'", lr_str);
+    GRL_DEBUG ("Podcast last-refreshed: '%s'", lr_str);
     g_time_val_from_iso8601 (lr_str ? lr_str : "", &lr);
     g_get_current_time (&now);
     now.tv_sec -= CACHE_DURATION;
     if (now.tv_sec >= lr.tv_sec) {
       /* We have to read the podcast feed again */
-      g_debug ("Refreshing podcast '%s'...", os->media_id);
+      GRL_DEBUG ("Refreshing podcast '%s'...", os->media_id);
       url = g_strdup ((gchar *) sqlite3_column_text (sql_stmt, PODCAST_URL));
       read_url_async (url, read_feed_cb, os);
       g_free (url);
@@ -1177,7 +1181,7 @@ produce_podcasts (OperationSpec *os)
   GList *iter;
   gchar *sql;
 
-  g_debug ("produce_podcasts");
+  GRL_DEBUG ("produce_podcasts");
 
   db = GRL_PODCASTS_SOURCE (os->source)->priv->db;
 
@@ -1193,12 +1197,12 @@ produce_podcasts (OperationSpec *os)
     sql = g_strdup_printf (GRL_SQL_GET_PODCASTS_BY_TEXT,
 			   os->text, os->text, os->count, os->skip);
   }
-  g_debug ("%s", sql);
+  GRL_DEBUG ("%s", sql);
   r = sqlite3_prepare_v2 (db, sql, strlen (sql), &sql_stmt, NULL);
   g_free (sql);
 
   if (r != SQLITE_OK) {
-    g_warning ("Failed to retrieve podcasts: %s", sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to retrieve podcasts: %s", sqlite3_errmsg (db));
     error = g_error_new (GRL_CORE_ERROR,
 			 os->error_code,
 			 "Failed to retrieve podcasts list");
@@ -1217,7 +1221,7 @@ produce_podcasts (OperationSpec *os)
   }
 
   if (r != SQLITE_DONE) {
-    g_warning ("Failed to retrieve podcasts: %s", sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to retrieve podcasts: %s", sqlite3_errmsg (db));
     error = g_error_new (GRL_CORE_ERROR,
 			 os->error_code,
 			 "Failed to retrieve podcasts list");
@@ -1259,18 +1263,18 @@ stream_metadata (GrlMediaSourceMetadataSpec *ms)
   gchar *sql;
   const gchar *id;
 
-  g_debug ("stream_metadata");
+  GRL_DEBUG ("stream_metadata");
 
   db = GRL_PODCASTS_SOURCE (ms->source)->priv->db;
 
   id = grl_media_get_id (ms->media);
   sql = g_strdup_printf (GRL_SQL_GET_PODCAST_STREAM, id);
-  g_debug ("%s", sql);
+  GRL_DEBUG ("%s", sql);
   r = sqlite3_prepare_v2 (db, sql, strlen (sql), &sql_stmt, NULL);
   g_free (sql);
 
   if (r != SQLITE_OK) {
-    g_warning ("Failed to get podcast stream: %s", sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to get podcast stream: %s", sqlite3_errmsg (db));
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_METADATA_FAILED,
 			 "Failed to get podcast stream metadata");
@@ -1285,7 +1289,7 @@ stream_metadata (GrlMediaSourceMetadataSpec *ms)
     build_media_from_stmt (ms->media, sql_stmt, FALSE);
     ms->callback (ms->source, ms->media, ms->user_data, NULL);
   } else {
-    g_warning ("Failed to get podcast stream: %s", sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to get podcast stream: %s", sqlite3_errmsg (db));
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_METADATA_FAILED,
 			 "Failed to get podcast stream metadata");
@@ -1304,7 +1308,7 @@ podcast_metadata (GrlMediaSourceMetadataSpec *ms)
   GError *error = NULL;
   const gchar *id;
 
-  g_debug ("podcast_metadata");
+  GRL_DEBUG ("podcast_metadata");
 
   db = GRL_PODCASTS_SOURCE (ms->source)->priv->db;
 
@@ -1323,7 +1327,7 @@ podcast_metadata (GrlMediaSourceMetadataSpec *ms)
     ms->callback (ms->source, ms->media, ms->user_data, NULL);
     sqlite3_finalize (sql_stmt);
   } else {
-    g_warning ("Failed to get podcast: %s", sqlite3_errmsg (db));
+    GRL_WARNING ("Failed to get podcast: %s", sqlite3_errmsg (db));
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_METADATA_FAILED,
 			 "Failed to get podcast metadata");
@@ -1359,7 +1363,7 @@ static void
 grl_podcasts_source_browse (GrlMediaSource *source,
                             GrlMediaSourceBrowseSpec *bs)
 {
-  g_debug ("grl_podcasts_source_browse");
+  GRL_DEBUG ("grl_podcasts_source_browse");
 
   OperationSpec *os;
   GrlPodcastsSource *podcasts_source;
@@ -1367,7 +1371,7 @@ grl_podcasts_source_browse (GrlMediaSource *source,
 
   podcasts_source = GRL_PODCASTS_SOURCE (source);
   if (!podcasts_source->priv->db) {
-    g_warning ("Can't execute operation: no database connection.");
+    GRL_WARNING ("Can't execute operation: no database connection.");
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_BROWSE_FAILED,
 			 "No database connection");
@@ -1402,7 +1406,7 @@ static void
 grl_podcasts_source_search (GrlMediaSource *source,
                             GrlMediaSourceSearchSpec *ss)
 {
-  g_debug ("grl_podcasts_source_search");
+  GRL_DEBUG ("grl_podcasts_source_search");
 
   GrlPodcastsSource *podcasts_source;
   OperationSpec *os;
@@ -1410,7 +1414,7 @@ grl_podcasts_source_search (GrlMediaSource *source,
 
   podcasts_source = GRL_PODCASTS_SOURCE (source);
   if (!podcasts_source->priv->db) {
-    g_warning ("Can't execute operation: no database connection.");
+    GRL_WARNING ("Can't execute operation: no database connection.");
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_QUERY_FAILED,
 			 "No database connection");
@@ -1434,7 +1438,7 @@ grl_podcasts_source_search (GrlMediaSource *source,
 static void
 grl_podcasts_source_query (GrlMediaSource *source, GrlMediaSourceQuerySpec *qs)
 {
-  g_debug ("grl_podcasts_source_query");
+  GRL_DEBUG ("grl_podcasts_source_query");
 
   GrlPodcastsSource *podcasts_source;
   OperationSpec *os;
@@ -1442,7 +1446,7 @@ grl_podcasts_source_query (GrlMediaSource *source, GrlMediaSourceQuerySpec *qs)
 
   podcasts_source = GRL_PODCASTS_SOURCE (source);
   if (!podcasts_source->priv->db) {
-    g_warning ("Can't execute operation: no database connection.");
+    GRL_WARNING ("Can't execute operation: no database connection.");
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_QUERY_FAILED,
 			 "No database connection");
@@ -1468,7 +1472,7 @@ static void
 grl_podcasts_source_metadata (GrlMediaSource *source,
                               GrlMediaSourceMetadataSpec *ms)
 {
-  g_debug ("grl_podcasts_source_metadata");
+  GRL_DEBUG ("grl_podcasts_source_metadata");
 
   GrlPodcastsSource *podcasts_source;
   GError *error = NULL;
@@ -1476,7 +1480,7 @@ grl_podcasts_source_metadata (GrlMediaSource *source,
 
   podcasts_source = GRL_PODCASTS_SOURCE (source);
   if (!podcasts_source->priv->db) {
-    g_warning ("Can't execute operation: no database connection.");
+    GRL_WARNING ("Can't execute operation: no database connection.");
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_METADATA_FAILED,
 			 "No database connection");
@@ -1495,7 +1499,7 @@ grl_podcasts_source_metadata (GrlMediaSource *source,
 static void
 grl_podcasts_source_store (GrlMediaSource *source, GrlMediaSourceStoreSpec *ss)
 {
-  g_debug ("grl_podcasts_source_store");
+  GRL_DEBUG ("grl_podcasts_source_store");
   GError *error = NULL;
   if (GRL_IS_MEDIA_BOX (ss->media)) {
     error = g_error_new (GRL_CORE_ERROR,
@@ -1516,7 +1520,7 @@ static void
 grl_podcasts_source_remove (GrlMediaSource *source,
                             GrlMediaSourceRemoveSpec *rs)
 {
-  g_debug ("grl_podcasts_source_remove");
+  GRL_DEBUG ("grl_podcasts_source_remove");
   GError *error = NULL;
   if (media_id_is_podcast (rs->media_id)) {
     remove_podcast (GRL_PODCASTS_SOURCE (rs->source)->priv->db,
diff --git a/src/shoutcast/grl-shoutcast.c b/src/shoutcast/grl-shoutcast.c
index 4e6e039..7405d1a 100644
--- a/src/shoutcast/grl-shoutcast.c
+++ b/src/shoutcast/grl-shoutcast.c
@@ -40,8 +40,8 @@
 
 /* --------- Logging  -------- */
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "grl-shoutcast"
+#define GRL_LOG_DOMAIN_DEFAULT shoutcast_log_domain
+GRL_LOG_DOMAIN_STATIC(shoutcast_log_domain);
 
 /* ------ SHOUTcast API ------ */
 
@@ -115,7 +115,9 @@ grl_shoutcast_plugin_init (GrlPluginRegistry *registry,
                            const GrlPluginInfo *plugin,
                            GList *configs)
 {
-  g_debug ("shoutcast_plugin_init\n");
+  GRL_LOG_DOMAIN_INIT (shoutcast_log_domain, "shoutcast");
+
+  GRL_DEBUG ("shoutcast_plugin_init");
 
   GrlShoutcastSource *source = grl_shoutcast_source_new ();
   grl_plugin_registry_register_source (registry,
@@ -133,7 +135,7 @@ GRL_PLUGIN_REGISTER (grl_shoutcast_plugin_init,
 static GrlShoutcastSource *
 grl_shoutcast_source_new (void)
 {
-  g_debug ("grl_shoutcast_source_new");
+  GRL_DEBUG ("grl_shoutcast_source_new");
   return g_object_new (GRL_SHOUTCAST_SOURCE_TYPE,
 		       "source-id", SOURCE_ID,
 		       "source-name", SOURCE_NAME,
@@ -455,7 +457,7 @@ xml_parse_result (const gchar *str, OperationData *op_data)
 static gboolean
 expire_cache (gpointer user_data)
 {
-  g_debug ("Cached page expired");
+  GRL_DEBUG ("Cached page expired");
   cached_page_expired = TRUE;
   return FALSE;
 }
@@ -497,7 +499,7 @@ read_done_cb (GObject *source_object,
   cache = op_data->cache;
   xml_parse_result (content, op_data);
   if (cache && cached_page_expired) {
-    g_debug ("Caching page");
+    GRL_DEBUG ("Caching page");
     g_free (cached_page);
     cached_page = content;
     cached_page_expired = FALSE;
@@ -521,11 +523,11 @@ read_url_async (const gchar *url, OperationData *op_data)
   GFile *uri;
 
   if (op_data->cache && !cached_page_expired) {
-    g_debug ("Using cached page");
+    GRL_DEBUG ("Using cached page");
     g_idle_add ((GSourceFunc) read_cached_page, op_data);
   } else {
     vfs = g_vfs_get_default ();
-    g_debug ("Opening '%s'", url);
+    GRL_DEBUG ("Opening '%s'", url);
     uri = g_vfs_get_file_for_uri (vfs, url);
     g_file_load_contents_async (uri, NULL, read_done_cb, op_data);
   }
@@ -620,7 +622,7 @@ grl_shoutcast_source_browse (GrlMediaSource *source,
   const gchar *container_id;
   gchar *url;
 
-  g_debug ("grl_shoutcast_source_browse");
+  GRL_DEBUG ("grl_shoutcast_source_browse");
 
   data = g_slice_new0 (OperationData);
   data->source = source;
@@ -700,7 +702,7 @@ grl_shoutcast_source_cancel (GrlMediaSource *source, guint operation_id)
 {
   OperationData *op_data;
 
-  g_debug ("grl_shoutcast_source_cancel");
+  GRL_DEBUG ("grl_shoutcast_source_cancel");
 
   op_data = (OperationData *) grl_media_source_get_operation_data (source, operation_id);
 
diff --git a/src/upnp/grl-upnp.c b/src/upnp/grl-upnp.c
index fdd7d63..50ea223 100644
--- a/src/upnp/grl-upnp.c
+++ b/src/upnp/grl-upnp.c
@@ -43,8 +43,8 @@
 
 /* --------- Logging  -------- */
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "grl-upnp"
+#define GRL_LOG_DOMAIN_DEFAULT upnp_log_domain
+GRL_LOG_DOMAIN_STATIC(upnp_log_domain);
 
 /* --- Plugin information --- */
 
@@ -142,7 +142,9 @@ grl_upnp_plugin_init (GrlPluginRegistry *registry,
   GUPnPContext *context;
   GUPnPControlPoint *cp;
 
-  g_debug ("grl_upnp_plugin_init\n");
+  GRL_LOG_DOMAIN_INIT (upnp_log_domain, "upnp");
+
+  GRL_DEBUG ("grl_upnp_plugin_init");
 
   /* libsoup needs this */
   if (!g_thread_supported()) {
@@ -189,7 +191,7 @@ grl_upnp_source_new (const gchar *source_id, const gchar *name)
   gchar *source_name, *source_desc;
   GrlUpnpSource *source;
 
-  g_debug ("grl_upnp_source_new");
+  GRL_DEBUG ("grl_upnp_source_new");
   source_name = g_strdup_printf (SOURCE_NAME_TEMPLATE, name);
   source_desc = g_strdup_printf (SOURCE_DESC_TEMPLATE, name);
 
@@ -239,7 +241,7 @@ grl_upnp_source_finalize (GObject *object)
 {
   GrlUpnpSource *source;
 
-  g_debug ("grl_upnp_source_finalize");
+  GRL_DEBUG ("grl_upnp_source_finalize");
 
   source = GRL_UPNP_SOURCE (object);
 
@@ -287,9 +289,9 @@ gupnp_search_caps_cb (GUPnPServiceProxy *service,
 				    "SearchCaps", G_TYPE_STRING, &caps,
 				    NULL);
   if (!result) {
-    g_warning ("Failed to execute GetSeachCaps operation");
+    GRL_WARNING ("Failed to execute GetSeachCaps operation");
     if (error) {
-      g_warning ("Reason: %s", error->message);
+      GRL_WARNING ("Reason: %s", error->message);
       g_error_free (error);
     }
   }
@@ -300,8 +302,8 @@ gupnp_search_caps_cb (GUPnPServiceProxy *service,
 
   registry = grl_plugin_registry_get_default ();
   if (grl_plugin_registry_lookup_source (registry, source_id)) {
-    g_debug ("A source with id '%s' is already registered. Skipping...",
-	     source_id);
+    GRL_DEBUG ("A source with id '%s' is already registered. Skipping...",
+               source_id);
     goto free_resources;
   }
 
@@ -309,13 +311,13 @@ gupnp_search_caps_cb (GUPnPServiceProxy *service,
   source->priv->device = g_object_ref (source_info->device);
   source->priv->service = g_object_ref (source_info->service);
 
-  g_debug ("Search caps for source '%s': '%s'", name, caps);
+  GRL_DEBUG ("Search caps for source '%s': '%s'", name, caps);
 
   if (caps && caps[0] != '\0') {
-    g_debug ("Setting search enabled for source '%s'", name );
+    GRL_DEBUG ("Setting search enabled for source '%s'", name );
     source->priv->search_enabled = TRUE;
   } else {
-    g_debug ("Setting search disabled for source '%s'", name );
+    GRL_DEBUG ("Setting search disabled for source '%s'", name );
   }
 
   grl_plugin_registry_register_source (registry,
@@ -338,10 +340,10 @@ device_available_cb (GUPnPControlPoint *cp,
   GrlPluginRegistry *registry;
   gchar *source_id;
 
-  g_debug ("device_available_cb");
+  GRL_DEBUG ("device_available_cb");
 
   type = gupnp_device_info_get_device_type (GUPNP_DEVICE_INFO (device));
-  g_debug ("  type: %s", type);
+  GRL_DEBUG ("  type: %s", type);
   if (!g_pattern_match_simple ("urn:schemas-upnp-org:device:MediaServer:*",
 			       type)) {
     return;
@@ -350,21 +352,21 @@ device_available_cb (GUPnPControlPoint *cp,
   service = gupnp_device_info_get_service (GUPNP_DEVICE_INFO (device),
 					   CONTENT_DIR_SERVICE);
   if (!service) {
-    g_debug ("Device does not provide requied service, ignoring...");
+    GRL_DEBUG ("Device does not provide requied service, ignoring...");
     return;
   }
 
   udn = gupnp_device_info_get_udn (GUPNP_DEVICE_INFO (device));
-  g_debug ("   udn: %s ", udn);
+  GRL_DEBUG ("   udn: %s ", udn);
 
   name = gupnp_device_info_get_friendly_name (GUPNP_DEVICE_INFO (device));
-  g_debug ("  name: %s", name);
+  GRL_DEBUG ("  name: %s", name);
 
   registry = grl_plugin_registry_get_default ();
   source_id = build_source_id (udn);
   if (grl_plugin_registry_lookup_source (registry, source_id)) {
-    g_debug ("A source with id '%s' is already registered. Skipping...",
-	     source_id);
+    GRL_DEBUG ("A source with id '%s' is already registered. Skipping...",
+               source_id);
     goto free_resources;
   }
 
@@ -383,8 +385,8 @@ device_available_cb (GUPnPControlPoint *cp,
 					 source_info,
 					 NULL)) {
     GrlUpnpSource *source = grl_upnp_source_new (source_id, name);
-    g_warning ("Failed to start GetCapabilitiesSearch action");
-    g_debug ("Setting search disabled for source '%s'", name );
+    GRL_WARNING ("Failed to start GetCapabilitiesSearch action");
+    GRL_DEBUG ("Setting search disabled for source '%s'", name );
     registry = grl_plugin_registry_get_default ();
     grl_plugin_registry_register_source (registry,
                                          source_info->plugin,
@@ -407,16 +409,16 @@ device_unavailable_cb (GUPnPControlPoint *cp,
   GrlPluginRegistry *registry;
   gchar *source_id;
 
-  g_debug ("device_unavailable_cb");
+  GRL_DEBUG ("device_unavailable_cb");
 
   udn = gupnp_device_info_get_udn (GUPNP_DEVICE_INFO (device));
-  g_debug ("   udn: %s ", udn);
+  GRL_DEBUG ("   udn: %s ", udn);
 
   registry = grl_plugin_registry_get_default ();
   source_id = build_source_id (udn);
   source = grl_plugin_registry_lookup_source (registry, source_id);
   if (!source) {
-    g_debug ("No source registered with id '%s', ignoring", source_id);
+    GRL_DEBUG ("No source registered with id '%s', ignoring", source_id);
   } else {
     grl_plugin_registry_unregister_source (registry, source);
   }
@@ -767,7 +769,7 @@ build_media_from_didl (GrlMedia *content,
   GList *didl_props;
   GList *iter;
 
-  g_debug ("build_media_from_didl");
+  GRL_DEBUG ("build_media_from_didl");
 
   if (content) {
     media = content;
@@ -865,7 +867,7 @@ gupnp_browse_cb (GUPnPServiceProxy *service,
 
   os = (struct OperationSpec *) user_data;
 
-  g_debug ("gupnp_browse_cb");
+  GRL_DEBUG ("gupnp_browse_cb");
 
   result =
     gupnp_service_proxy_end_action (service, action, &error,
@@ -875,17 +877,17 @@ gupnp_browse_cb (GUPnPServiceProxy *service,
 				    NULL);
 
   if (!result) {
-    g_warning ("Browse operation failed");
+    GRL_WARNING ("Browse operation failed");
     os->callback (os->source, os->operation_id, NULL, 0, os->user_data, error);
     if (error) {
-      g_warning ("  Reason: %s", error->message);
+      GRL_WARNING ("  Reason: %s", error->message);
       g_error_free (error);
     }
     return;
   }
 
   if (!didl || !returned) {
-    g_debug ("Got no results");
+    GRL_DEBUG ("Got no results");
     os->callback (os->source, os->operation_id, NULL, 0, os->user_data, NULL);
     return;
   }
@@ -914,7 +916,7 @@ gupnp_browse_cb (GUPnPServiceProxy *service,
 #endif
 
   if (error) {
-    g_warning ("Failed to parse DIDL result: %s", error->message);
+    GRL_WARNING ("Failed to parse DIDL result: %s", error->message);
     os->callback (os->source, os->operation_id, NULL, 0, os->user_data, error);
     g_error_free (error);
     return;
@@ -951,7 +953,7 @@ gupnp_metadata_cb (GUPnPServiceProxy *service,
   GrlMediaSourceMetadataSpec *ms;
   GUPnPDIDLLiteParser *didl_parser;
 
-  g_debug ("gupnp_metadata_cb");
+  GRL_DEBUG ("gupnp_metadata_cb");
 
   ms = (GrlMediaSourceMetadataSpec *) user_data;
 
@@ -961,17 +963,17 @@ gupnp_metadata_cb (GUPnPServiceProxy *service,
 				    NULL);
 
   if (!result) {
-    g_warning ("Metadata operation failed");
+    GRL_WARNING ("Metadata operation failed");
     ms->callback (ms->source, ms->media, ms->user_data, error);
     if (error) {
-      g_warning ("  Reason: %s", error->message);
+      GRL_WARNING ("  Reason: %s", error->message);
       g_error_free (error);
     }
     return;
   }
 
   if (!didl) {
-    g_debug ("Got no metadata");
+    GRL_DEBUG ("Got no metadata");
     ms->callback (ms->source, ms->media,  ms->user_data, NULL);
     return;
   }
@@ -995,7 +997,7 @@ gupnp_metadata_cb (GUPnPServiceProxy *service,
 #endif
 
   if (error) {
-    g_warning ("Failed to parse DIDL result: %s", error->message);
+    GRL_WARNING ("Failed to parse DIDL result: %s", error->message);
     ms->callback (ms->source, ms->media, ms->user_data, error);
     g_error_free (error);
     return;
@@ -1036,10 +1038,10 @@ grl_upnp_source_browse (GrlMediaSource *source, GrlMediaSourceBrowseSpec *bs)
   GError *error = NULL;
   struct OperationSpec *os;
 
-  g_debug ("grl_upnp_source_browse");
+  GRL_DEBUG ("grl_upnp_source_browse");
 
   upnp_filter = get_upnp_filter (bs->keys);
-  g_debug ("filter: '%s'", upnp_filter);
+  GRL_DEBUG ("filter: '%s'", upnp_filter);
 
   os = g_slice_new0 (struct OperationSpec);
   os->source = bs->source;
@@ -1090,13 +1092,13 @@ grl_upnp_source_search (GrlMediaSource *source, GrlMediaSourceSearchSpec *ss)
   gchar *upnp_search;
   struct OperationSpec *os;
 
-  g_debug ("grl_upnp_source_search");
+  GRL_DEBUG ("grl_upnp_source_search");
 
   upnp_filter = get_upnp_filter (ss->keys);
-  g_debug ("filter: '%s'", upnp_filter);
+  GRL_DEBUG ("filter: '%s'", upnp_filter);
 
   upnp_search = get_upnp_search (ss->text);
-  g_debug ("search: '%s'", upnp_search);
+  GRL_DEBUG ("search: '%s'", upnp_search);
 
   os = g_slice_new0 (struct OperationSpec);
   os->source = ss->source;
@@ -1142,11 +1144,11 @@ grl_upnp_source_metadata (GrlMediaSource *source,
   gchar *id;
   GError *error = NULL;
 
-  g_debug ("grl_upnp_source_metadata");
+  GRL_DEBUG ("grl_upnp_source_metadata");
 
   upnp_filter = get_upnp_filter (ms->keys);
 
-  g_debug ("filter: '%s'", upnp_filter);
+  GRL_DEBUG ("filter: '%s'", upnp_filter);
 
   id = (gchar *) grl_media_get_id (ms->media);
   if (!id) {
diff --git a/src/vimeo/grl-vimeo.c b/src/vimeo/grl-vimeo.c
index 7fb0ef1..268ff1c 100644
--- a/src/vimeo/grl-vimeo.c
+++ b/src/vimeo/grl-vimeo.c
@@ -41,8 +41,8 @@
 
 /* --------- Logging  -------- */
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "grl-vimeo"
+#define GRL_LOG_DOMAIN_DEFAULT vimeo_log_domain
+GRL_LOG_DOMAIN_STATIC(vimeo_log_domain);
 
 /* --- Plugin information --- */
 
@@ -93,20 +93,22 @@ grl_vimeo_plugin_init (GrlPluginRegistry *registry,
   gint config_count;
   GrlVimeoSource *source;
 
-  g_debug ("vimeo_plugin_init\n");
+  GRL_LOG_DOMAIN_INIT (vimeo_log_domain, "vimeo");
+
+  GRL_DEBUG ("vimeo_plugin_init");
 
   if (!g_thread_supported ()) {
     g_thread_init (NULL);
   }
 
   if (!configs) {
-    g_warning ("Missing configuration");
+    GRL_WARNING ("Missing configuration");
     return FALSE;
   }
 
   config_count = g_list_length (configs);
   if (config_count > 1) {
-    g_warning ("Provided %d configs, but will only use one", config_count);
+    GRL_WARNING ("Provided %d configs, but will only use one", config_count);
   }
 
   config = GRL_CONFIG (configs->data);
@@ -115,7 +117,7 @@ grl_vimeo_plugin_init (GrlPluginRegistry *registry,
   vimeo_secret = grl_config_get_api_secret (config);
 
   if (!vimeo_key || !vimeo_secret) {
-    g_warning ("Required configuration keys not set up");
+    GRL_WARNING ("Required configuration keys not set up");
     return FALSE;
   }
 
@@ -137,7 +139,7 @@ GRL_PLUGIN_REGISTER (grl_vimeo_plugin_init,
 static GrlVimeoSource *
 grl_vimeo_source_new (void)
 {
-  g_debug ("grl_vimeo_source_new");
+  GRL_DEBUG ("grl_vimeo_source_new");
 
   return g_object_new (GRL_VIMEO_SOURCE_TYPE,
                        "source-id", SOURCE_ID,
diff --git a/src/youtube/grl-youtube.c b/src/youtube/grl-youtube.c
index 8c24923..d701851 100644
--- a/src/youtube/grl-youtube.c
+++ b/src/youtube/grl-youtube.c
@@ -33,8 +33,8 @@
 
 /* --------- Logging  -------- */
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "grl-youtube"
+#define GRL_LOG_DOMAIN_DEFAULT youtube_log_domain
+GRL_LOG_DOMAIN_STATIC(youtube_log_domain);
 
 /* ----- Root categories ---- */
 
@@ -223,22 +223,24 @@ grl_youtube_plugin_init (GrlPluginRegistry *registry,
   GrlConfig *config;
   gint config_count;
 
-  g_debug ("youtube_plugin_init");
+  GRL_LOG_DOMAIN_INIT (youtube_log_domain, "youtube");
+
+  GRL_DEBUG ("youtube_plugin_init");
 
   if (!configs) {
-    g_warning ("Configuration not provided! Cannot configure plugin.");
+    GRL_WARNING ("Configuration not provided! Cannot configure plugin.");
     return FALSE;
   }
 
   config_count = g_list_length (configs);
   if (config_count > 1) {
-    g_warning ("Provided %d configs, but will only use one", config_count);
+    GRL_WARNING ("Provided %d configs, but will only use one", config_count);
   }
 
   config = GRL_CONFIG (configs->data);
   api_key = grl_config_get_api_key (config);
   if (!api_key) {
-    g_warning ("Missing API Key, cannot configure Youtube plugin");
+    GRL_WARNING ("Missing API Key, cannot configure Youtube plugin");
     return FALSE;
   }
 
@@ -265,14 +267,14 @@ GRL_PLUGIN_REGISTER (grl_youtube_plugin_init,
 static GrlYoutubeSource *
 grl_youtube_source_new (const gchar *api_key, const gchar *client_id)
 {
-  g_debug ("grl_youtube_source_new");
+  GRL_DEBUG ("grl_youtube_source_new");
 
   GrlYoutubeSource *source;
   GDataYouTubeService *service;
 
   service = gdata_youtube_service_new (api_key, client_id);
   if (!service) {
-    g_warning ("Failed to initialize gdata service");
+    GRL_WARNING ("Failed to initialize gdata service");
     return NULL;
   }
 
@@ -322,7 +324,7 @@ G_DEFINE_TYPE (GrlYoutubeSource, grl_youtube_source, GRL_TYPE_MEDIA_SOURCE);
 static OperationSpec *
 operation_spec_new ()
 {
-  g_debug ("Allocating new spec");
+  GRL_DEBUG ("Allocating new spec");
   OperationSpec *os =  g_slice_new0 (OperationSpec);
   os->ref_count = 1;
   return os;
@@ -334,14 +336,14 @@ operation_spec_unref (OperationSpec *os)
   os->ref_count--;
   if (os->ref_count == 0) {
     g_slice_free (OperationSpec, os);
-    g_debug ("freeing spec");
+    GRL_DEBUG ("freeing spec");
   }
 }
 
 static void
 operation_spec_ref (OperationSpec *os)
 {
-  g_debug ("Reffing spec");
+  GRL_DEBUG ("Reffing spec");
   os->ref_count++;
 }
 
@@ -362,7 +364,7 @@ read_done_cb (GObject *source_object,
                                &vfs_error);
   g_object_unref (source_object);
   if (vfs_error) {
-    g_warning ("Failed to open '%s': %s", arc->url, vfs_error->message);
+    GRL_WARNING ("Failed to open '%s': %s", arc->url, vfs_error->message);
     arc->callback (NULL, arc->user_data);
   } else {
     arc->callback (content, arc->user_data);
@@ -379,7 +381,7 @@ read_url_async (const gchar *url,
   GFile *uri;
   AsyncReadCb *arc;
 
-  g_debug ("Opening async '%s'", url);
+  GRL_DEBUG ("Opening async '%s'", url);
 
   arc = g_slice_new0 (AsyncReadCb);
   arc->url = g_strdup (url);
@@ -428,7 +430,7 @@ set_media_url_async_read_cb (gchar *data, gpointer user_data)
       g_strfreev (mapping);
     }
   } else {
-    g_debug ("Format array not found, using token workaround");
+    GRL_DEBUG ("Format array not found, using token workaround");
     gchar *token_start;
     gchar *token_end;
     gchar *token;
@@ -585,7 +587,7 @@ build_media_from_entry (GrlMedia *content,
 static void
 parse_categories (xmlDocPtr doc, xmlNodePtr node, GDataService *service)
 {
-  g_debug ("parse_categories");
+  GRL_DEBUG ("parse_categories");
 
   guint total = 0;
   GList *all = NULL, *iter;
@@ -602,7 +604,7 @@ parse_categories (xmlDocPtr doc, xmlNodePtr node, GDataService *service)
     g_free (id);
     node = node->next;
     total++;
-    g_debug ("  Found category: '%d - %s'", index++, cat_info->name);
+    GRL_DEBUG ("  Found category: '%d - %s'", index++, cat_info->name);
   }
 
   if (all) {
@@ -713,7 +715,7 @@ get_category_index_from_id (const gchar *category_id)
 static void
 item_count_cb (GObject *object, GAsyncResult *result, CategoryCountCb *cc)
 {
-  g_debug ("item_count_cb");
+  GRL_DEBUG ("item_count_cb");
 
   GDataFeed *feed;
   GError *error = NULL;
@@ -721,13 +723,13 @@ item_count_cb (GObject *object, GAsyncResult *result, CategoryCountCb *cc)
   feed = gdata_service_query_finish (GDATA_SERVICE (cc->service),
 				     result, &error);
   if (error) {
-    g_warning ("Failed to compute count for category '%s': %s",
-	       cc->category_info->id, error->message);
+    GRL_WARNING ("Failed to compute count for category '%s': %s",
+                 cc->category_info->id, error->message);
     g_error_free (error);
   } else if (feed) {
     cc->category_info->count = gdata_feed_get_total_results (feed);
-    g_debug ("Category '%s' - childcount: '%u'", 
-	     cc->category_info->id, cc->category_info->count);
+    GRL_DEBUG ("Category '%s' - childcount: '%u'",
+               cc->category_info->id, cc->category_info->count);
   }
 
   if (feed) {
@@ -741,10 +743,10 @@ compute_category_counts (GDataService *service)
 {
   gint i;
 
-  g_debug ("compute_category_counts");
+  GRL_DEBUG ("compute_category_counts");
 
   for (i=0; i<root_dir[ROOT_DIR_CATEGORIES_INDEX].count; i++) {
-    g_debug ("Computing chilcount for category '%s'", categories_dir[i].id);
+    GRL_DEBUG ("Computing chilcount for category '%s'", categories_dir[i].id);
     GDataQuery *query = gdata_query_new_with_limits (NULL, 0, 1);
     const gchar *category_term =
       get_category_term_from_id (categories_dir[i].id);
@@ -765,10 +767,10 @@ static void
 compute_feed_counts (GDataService *service)
 {
   gint i;
-  g_debug ("compute_feed_counts");
+  GRL_DEBUG ("compute_feed_counts");
 
   for (i=0; i<root_dir[ROOT_DIR_FEEDS_INDEX].count; i++) {
-    g_debug ("Computing chilcount for feed '%s'", feeds_dir[i].id);
+    GRL_DEBUG ("Computing chilcount for feed '%s'", feeds_dir[i].id);
     gint feed_type = get_feed_type_from_id (feeds_dir[i].id);
     GDataQuery *query = gdata_query_new_with_limits (NULL, 0, 1);
     CategoryCountCb *cc = g_slice_new (CategoryCountCb);
@@ -813,7 +815,7 @@ build_media_from_entry_search_cb (GrlMedia *media, gpointer user_data)
 		  os->user_data,
 		  NULL);
     if (remaining == 0) {
-      g_debug ("Unreffing spec in build_media_from_entry_search_cb");
+      GRL_DEBUG ("Unreffing spec in build_media_from_entry_search_cb");
       operation_spec_unref (os);
     } else {
       os->emitted++;
@@ -824,7 +826,7 @@ build_media_from_entry_search_cb (GrlMedia *media, gpointer user_data)
 static void
 build_directories (GDataService *service)
 {
-  g_debug ("build_drectories");
+  GRL_DEBUG ("build_drectories");
 
   /* Parse category list from Youtube and compute category counts */
   read_url_async (YOUTUBE_CATEGORIES_URL,
@@ -840,7 +842,7 @@ metadata_cb (GObject *object,
 	     GAsyncResult *result,
 	     gpointer user_data)
 {
-  g_debug ("metadata_cb");
+  GRL_DEBUG ("metadata_cb");
 
   GError *error = NULL;
   GrlYoutubeSource *source;
@@ -888,7 +890,7 @@ search_progress_cb (GDataEntry *entry,
     build_media_from_entry (NULL, entry, os->keys,
 			    build_media_from_entry_search_cb, os);
   } else {
-    g_warning ("Invalid index/count received grom libgdata, ignoring result");
+    GRL_WARNING ("Invalid index/count received grom libgdata, ignoring result");
   }
 
   /* The entry will be freed when freeing the feed in search_cb */
@@ -897,7 +899,7 @@ search_progress_cb (GDataEntry *entry,
 static void
 search_cb (GObject *object, GAsyncResult *result, OperationSpec *os)
 {
-  g_debug ("search_cb");
+  GRL_DEBUG ("search_cb");
 
   GDataFeed *feed;
   GError *error = NULL;
@@ -920,7 +922,7 @@ search_cb (GObject *object, GAsyncResult *result, OperationSpec *os)
        * and the last one was sent with remaining>0, in that case
        * we should send a finishing message now. */
       if (os->emitted == os->count) {
-	g_debug ("sending finishing message");
+	GRL_DEBUG ("sending finishing message");
 	os->callback (os->source, os->operation_id,
 		      NULL, 0, os->user_data, NULL);
 	need_extra_unref = TRUE;
@@ -942,11 +944,11 @@ search_cb (GObject *object, GAsyncResult *result, OperationSpec *os)
   if (feed)
     g_object_unref (feed);
 
-  g_debug ("Unreffing spec in search_cb");
+  GRL_DEBUG ("Unreffing spec in search_cb");
   operation_spec_unref (os);
   if (need_extra_unref) {
     /* We did not free the spec in the emission callback, do it here */
-    g_debug ("need extra spec unref in search_cb");
+    GRL_DEBUG ("need extra spec unref in search_cb");
     operation_spec_unref (os);
   }
 }
@@ -1055,7 +1057,7 @@ produce_container_from_directory (GDataService *service,
 static void
 produce_from_directory (CategoryInfo *dir, guint dir_size, OperationSpec *os)
 {
-  g_debug ("produce_from_directory");
+  GRL_DEBUG ("produce_from_directory");
 
   guint index, remaining;
 
@@ -1236,7 +1238,7 @@ grl_youtube_source_search (GrlMediaSource *source,
   OperationSpec *os;
   GDataQuery *query;
 
-  g_debug ("grl_youtube_source_search (%u, %u)", ss->skip, ss->count);
+  GRL_DEBUG ("grl_youtube_source_search (%u, %u)", ss->skip, ss->count);
 
   os = operation_spec_new ();
   os->source = source;
@@ -1269,7 +1271,7 @@ grl_youtube_source_browse (GrlMediaSource *source,
   OperationSpec *os;
   const gchar *container_id;
 
-  g_debug ("grl_youtube_source_browse: %s", grl_media_get_id (bs->container));
+  GRL_DEBUG ("grl_youtube_source_browse: %s", grl_media_get_id (bs->container));
 
   container_id = grl_media_get_id (bs->container);
 
@@ -1320,7 +1322,7 @@ grl_youtube_source_metadata (GrlMediaSource *source,
   GError *error = NULL;
   GrlMedia *media = NULL;
 
-  g_debug ("grl_youtube_source_metadata");
+  GRL_DEBUG ("grl_youtube_source_metadata");
 
   id = grl_media_get_id (ms->media);
   media_type = classify_media_id (id);
diff --git a/test/main.c b/test/main.c
index 0501a84..996d7a4 100644
--- a/test/main.c
+++ b/test/main.c
@@ -25,44 +25,44 @@
 
 #include <grilo.h>
 
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "test-main"
+#define GRL_LOG_DOMAIN_DEFAULT test_main_log_domain
+GRL_LOG_DOMAIN_STATIC(test_main_log_domain);
 
 #define YOUTUBE_KEY "AI39si4EfscPllSfUy1IwexMf__kntTL_G5dfSr2iUEVN45RHGq92Aq0lX25OlnOkG6KTN-4soVAkAf67fWYXuHfVADZYr7S1A"
 
 static void
 print_supported_ops (GrlMetadataSource *source)
 {
-  g_debug ("  Operations available in '%s'",
-	   grl_metadata_source_get_name (source));
+  GRL_DEBUG ("  Operations available in '%s'",
+             grl_metadata_source_get_name (source));
 
   GrlSupportedOps caps = grl_metadata_source_supported_operations (source);
 
   if (caps & GRL_OP_METADATA) {
-    g_debug ("    + Metadata");
+    GRL_DEBUG ("    + Metadata");
   }
   if (caps & GRL_OP_RESOLVE) {
-    g_debug ("    + Resolution");
+    GRL_DEBUG ("    + Resolution");
   }
   if (caps & GRL_OP_BROWSE) {
-    g_debug ("    + Browse");
+    GRL_DEBUG ("    + Browse");
   }
   if (caps & GRL_OP_SEARCH) {
-    g_debug ("    + Search");
+    GRL_DEBUG ("    + Search");
   }
   if (caps & GRL_OP_QUERY) {
-    g_debug ("    + Query");
+    GRL_DEBUG ("    + Query");
   }
   if (caps & GRL_OP_STORE_PARENT) {
-    g_debug ("    + Store (parent)");
+    GRL_DEBUG ("    + Store (parent)");
   } else  if (caps & GRL_OP_STORE) {
-    g_debug ("    + Store");
+    GRL_DEBUG ("    + Store");
   }
   if (caps & GRL_OP_REMOVE) {
-    g_debug ("    + Remove");
+    GRL_DEBUG ("    + Remove");
   }
   if (caps & GRL_OP_SET_METADATA) {
-    g_debug ("    + Set Metadata");
+    GRL_DEBUG ("    + Set Metadata");
   }
 }
 
@@ -75,11 +75,11 @@ print_metadata (gpointer key, GrlData *content)
 
   const GValue *value = grl_data_get (content, key);
   if (value && G_VALUE_HOLDS_STRING (value)) {
-    g_debug ("\t%s: %s", GRL_METADATA_KEY_GET_NAME (key),
-	     g_value_get_string (value));
+    GRL_DEBUG ("\t%s: %s", GRL_METADATA_KEY_GET_NAME (key),
+               g_value_get_string (value));
   } else if (value && G_VALUE_HOLDS_INT (value)) {
-    g_debug ("\t%s: %d",  GRL_METADATA_KEY_GET_NAME (key),
-	     g_value_get_int (value));
+    GRL_DEBUG ("\t%s: %d",  GRL_METADATA_KEY_GET_NAME (key),
+               g_value_get_int (value));
   }
 }
 
@@ -112,20 +112,18 @@ browse_cb (GrlMediaSource *source,
   GList *keys;
   static guint index = 0;
 
-  g_debug ("  browse result (%d - %d|%d)",
-	   browse_id, index++, remaining);
+  GRL_DEBUG ("  browse result (%d - %d|%d)", browse_id, index++, remaining);
 
   if (error) {
     g_error ("Got error from browse: %s", error->message);
   }
 
   if (!media && remaining == 0) {
-    g_debug ("  No results");
+    GRL_DEBUG ("  No results");
     return;
   }
 
-  g_debug ("\tContainer: %s",
-	   GRL_IS_MEDIA_BOX(media) ? "yes" : "no");
+  GRL_DEBUG ("\tContainer: %s", GRL_IS_MEDIA_BOX(media) ? "yes" : "no");
 
   keys = grl_data_get_keys (GRL_DATA (media));
   g_list_foreach (keys, (GFunc) print_metadata, GRL_DATA (media));
@@ -133,7 +131,7 @@ browse_cb (GrlMediaSource *source,
   g_object_unref (media);
 
   if (remaining == 0) {
-    g_debug ("  Browse operation finished");
+    GRL_DEBUG ("  Browse operation finished");
   }
 }
 
@@ -145,25 +143,24 @@ metadata_cb (GrlMediaSource *source,
 {
   GList *keys;
 
-  g_debug ("  metadata_cb");
+  GRL_DEBUG ("  metadata_cb");
 
   if (error) {
-    g_debug ("Error: %s", error->message);
+    GRL_DEBUG ("Error: %s", error->message);
     return;
   }
 
-  g_debug ("    Got metadata for object '%s'",
-	   grl_media_get_id (GRL_MEDIA (media)));
+  GRL_DEBUG ("    Got metadata for object '%s'",
+             grl_media_get_id (GRL_MEDIA (media)));
 
-  g_debug ("\tContainer: %s",
-	   GRL_IS_MEDIA_BOX(media) ? "yes" : "no");
+  GRL_DEBUG ("\tContainer: %s", GRL_IS_MEDIA_BOX(media) ? "yes" : "no");
 
   keys = grl_data_get_keys (GRL_DATA (media));
   g_list_foreach (keys, (GFunc) print_metadata, GRL_DATA (media));
   g_list_free (keys);
   g_object_unref (media);
 
-  g_debug ("  Metadata operation finished");
+  GRL_DEBUG ("  Metadata operation finished");
 }
 
 static void
@@ -184,7 +181,7 @@ set_cb (GrlMetadataSource *source,
 {
   if (error) {
     g_critical ("%s: %d keys not written",
-		error->message, g_list_length (failed_keys));
+                error->message, g_list_length (failed_keys));
   }
 }
 
@@ -194,6 +191,9 @@ main (void)
   GList *keys;
 
   g_type_init ();
+  grl_init (NULL, NULL);
+
+  GRL_LOG_DOMAIN_INIT (test_main_log_domain, "test-main");
 
   grl_log_init ("*:warning,test-main:*,"
                 "grl-youtube:*,"
@@ -224,9 +224,9 @@ main (void)
                                     GRL_METADATA_KEY_RATING,
                                     NULL);
 
-  g_debug ("start");
+  GRL_DEBUG ("start");
 
-  g_debug ("loading plugins");
+  GRL_DEBUG ("loading plugins");
 
   GrlPluginRegistry *registry = grl_plugin_registry_get_default ();
 
@@ -257,7 +257,7 @@ main (void)
   grl_plugin_registry_load (registry,
                             "../src/podcasts/.libs/libgrlpodcasts.so");
 
-  g_debug ("Obtaining sources");
+  GRL_DEBUG ("Obtaining sources");
 
   GrlMediaSource *youtube =
     (GrlMediaSource *) grl_plugin_registry_lookup_source (registry,
@@ -312,7 +312,7 @@ main (void)
   g_assert (metadata_store);
   g_assert (bookmarks);
   g_assert (podcasts);
-  g_debug ("Supported operations");
+  GRL_DEBUG ("Supported operations");
 
   print_supported_ops (GRL_METADATA_SOURCE (youtube));
   print_supported_ops (GRL_METADATA_SOURCE (fs));
@@ -326,7 +326,7 @@ main (void)
   print_supported_ops (lastfm);
   print_supported_ops (metadata_store);
 
-  g_debug ("testing");
+  GRL_DEBUG ("testing");
 
   if (0) grl_media_source_browse (youtube, NULL, keys, 0, 5, GRL_RESOLVE_IDLE_RELAY , browse_cb, NULL);
   if (0) grl_media_source_browse (youtube, NULL, keys, 0, 5, GRL_RESOLVE_IDLE_RELAY , browse_cb, NULL);
@@ -395,12 +395,12 @@ main (void)
 				      GRL_WRITE_FULL, set_cb, NULL);
   }
 
-  g_debug ("Running main loop");
+  GRL_DEBUG ("Running main loop");
 
   GMainLoop *loop = g_main_loop_new (NULL, FALSE);
   g_main_loop_run (loop);
 
-  g_debug ("done");
+  GRL_DEBUG ("done");
 
   return 0;
 }
-- 
1.7.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]