From: Pierre-Luc Beaudoin Date: Fri, 1 May 2009 20:06:11 +0000 (-0400) Subject: Add CACHE debug level X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28175a8bdec54ced11b5b76cfe27df50c5f9847a;p=libchamplain Add CACHE debug level --- diff --git a/champlain/champlain-cache.c b/champlain/champlain-cache.c index 34732b4..92ccf37 100644 --- a/champlain/champlain-cache.c +++ b/champlain/champlain-cache.c @@ -18,6 +18,8 @@ #include "champlain-cache.h" +#define DEBUG_FLAG CHAMPLAIN_DEBUG_CACHE +#include "champlain-debug.h" #include "champlain-enum-types.h" #include "champlain-private.h" @@ -87,7 +89,7 @@ champlain_cache_dispose (GObject *object) error = sqlite3_close (priv->data); if (error != SQLITE_OK) - g_warning ("Sqlite returned error %d when closing cache.db", error); + DEBUG ("Sqlite returned error %d when closing cache.db", error); G_OBJECT_CLASS (champlain_cache_parent_class)->dispose (object); } @@ -138,14 +140,14 @@ champlain_cache_init (ChamplainCache *self) SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (error != SQLITE_OK) { - g_warning ("Sqlite returned error %d when opening cache.db", error); + DEBUG ("Sqlite returned error %d when opening cache.db", error); goto cleanup; } sqlite3_exec (priv->data, "CREATE TABLE etags (filename char(500) PRIMARY KEY, etag char (30))", NULL, NULL, &error_msg); if (error_msg != NULL) { - g_warning ("Creating table Etag failed: %s", error_msg); + DEBUG ("Creating table Etag failed: %s", error_msg); sqlite3_free (error_msg); goto cleanup; } @@ -236,7 +238,7 @@ champlain_cache_fill_tile (ChamplainCache *self, sqlite3_exec (priv->data, query, set_etag, tile, &error_msg); if (error_msg != NULL) { - g_warning ("Retrieving Etag failed: %s", error_msg); + DEBUG ("Retrieving Etag failed: %s", error_msg); sqlite3_free (error_msg); } @@ -285,7 +287,7 @@ champlain_cache_update_tile (ChamplainCache *self, sqlite3_exec (priv->data, query, NULL, NULL, &error); if (error != NULL) { - g_warning ("Saving Etag failed: %s", error); + DEBUG ("Saving Etag failed: %s", error); sqlite3_free (error); } diff --git a/champlain/champlain-debug.c b/champlain/champlain-debug.c index bd32860..825cfe0 100644 --- a/champlain/champlain-debug.c +++ b/champlain/champlain-debug.c @@ -39,6 +39,7 @@ static GDebugKey keys[] = { { "Engine", CHAMPLAIN_DEBUG_ENGINE }, { "View", CHAMPLAIN_DEBUG_VIEW }, { "Network", CHAMPLAIN_DEBUG_NETWORK }, + { "Cache", CHAMPLAIN_DEBUG_CACHE }, { "Other", CHAMPLAIN_DEBUG_OTHER }, { 0, } }; diff --git a/champlain/champlain-debug.h b/champlain/champlain-debug.h index 1679fa6..1ab116f 100644 --- a/champlain/champlain-debug.h +++ b/champlain/champlain-debug.h @@ -34,7 +34,8 @@ typedef enum CHAMPLAIN_DEBUG_ENGINE = 1 << 2, CHAMPLAIN_DEBUG_VIEW = 1 << 3, CHAMPLAIN_DEBUG_NETWORK = 1 << 4, - CHAMPLAIN_DEBUG_OTHER = 1 << 5, + CHAMPLAIN_DEBUG_CACHE = 1 << 5, + CHAMPLAIN_DEBUG_OTHER = 1 << 6, } ChamplainDebugFlags; gboolean champlain_debug_flag_is_set (ChamplainDebugFlags flag);