Give readable names to numeric debug tokens

This commit is contained in:
Christian Dywan 2012-09-12 00:33:54 +02:00
parent 886ad1b765
commit 4b533d2f51
6 changed files with 16 additions and 20 deletions

View file

@ -53,9 +53,9 @@ If the problem is a warning and not a crash, try this:
If you are interested in HTTP communication, try this:
'MIDORI_DEBUG=soup:2 _build/default/midori/midori'
'MIDORI_DEBUG=headers _build/default/midori/midori'
Where '2' can be a level between 1 and 3.
Where 'headers' can be replaced with 'body' to get full message contents.
If you are interested in (non-) touchscreen behaviour, try this:
@ -65,7 +65,7 @@ If you are interested in (non-) touchscreen behaviour, try this:
If you want to "dry run" without WebKitGTK+ rendering, try this:
'MIDORI_UNARMED=1 _build/default/midori/midori'
'MIDORI_DEBUG=unarmed _build/default/midori/midori'
If you want to test bookmarks, you can enable database tracing:

View file

@ -30,7 +30,7 @@
(__filter[4] != '-' && __filter[5] != '-')
#ifdef G_ENABLE_DEBUG
#define adblock_debug(dmsg, darg1, darg2) \
do { if (midori_debug ("adblock:1")) g_debug (dmsg, darg1, darg2); } while (0)
do { if (midori_debug ("adblock:match")) g_debug (dmsg, darg1, darg2); } while (0)
#else
#define adblock_debug(dmsg, darg1, darg2) /* nothing */
#endif
@ -903,7 +903,7 @@ adblock_resource_request_starting_cb (WebKitWebView* web_view,
}
#ifdef G_ENABLE_DEBUG
if (midori_debug ("adblock:2"))
if (midori_debug ("adblock:time"))
g_test_timer_start ();
#endif
if (adblock_is_matched (req_uri, page_uri))
@ -914,7 +914,7 @@ adblock_resource_request_starting_cb (WebKitWebView* web_view,
g_object_set_data (G_OBJECT (web_view), "blocked-uris", blocked_uris);
}
#ifdef G_ENABLE_DEBUG
if (midori_debug ("adblock:2"))
if (midori_debug ("adblock:time"))
g_debug ("match: %f%s", g_test_timer_elapsed (), "seconds");
#endif

View file

@ -905,8 +905,6 @@ midori_soup_session_settings_accept_language_cb (SoupSession* session,
MidoriWebSettings* settings)
{
const gchar* accept = midori_web_settings_get_accept_language (settings);
if (midori_debug ("soup"))
g_message ("Accept-Language set to '%s'", accept);
soup_message_headers_append (msg->request_headers, "Accept-Language", accept);
if (katze_object_get_boolean (settings, "strip-referer"))
@ -925,7 +923,7 @@ midori_soup_session_settings_accept_language_cb (SoupSession* session,
soup_uri_free (stripped_uri);
if (strcmp (stripped_referer, referer))
{
if (midori_debug ("soup"))
if (midori_debug ("referer"))
g_message ("Referer '%s' stripped to '%s'", referer, stripped_referer);
soup_message_headers_replace (msg->request_headers, "Referer",
stripped_referer);
@ -943,12 +941,10 @@ static void
midori_soup_session_debug (SoupSession* session)
{
gint soup_debug_level = 0;
if (midori_debug ("soup:1"))
soup_debug_level = 1;
else if (midori_debug ("soup:2"))
soup_debug_level = 2;
else if (midori_debug ("soup:3"))
soup_debug_level = 3;
if (midori_debug ("headers"))
soup_debug_level = SOUP_LOGGER_LOG_HEADERS;
else if (midori_debug ("body"))
soup_debug_level = SOUP_LOGGER_LOG_BODY;
if (soup_debug_level > 0)
{
SoupLogger* logger = soup_logger_new (soup_debug_level, -1);

View file

@ -1460,8 +1460,8 @@ midori_debug (const gchar* token)
{
static const gchar* debug_token = NULL;
const gchar* debug = g_getenv ("MIDORI_DEBUG");
const gchar* debug_tokens = "soup soup:1 soup:2 soup:3 cookies paths hsts ";
const gchar* full_debug_tokens = "adblock:1 adblock:2 startup bookmarks ";
const gchar* debug_tokens = "headers body referer cookies paths hsts unarmed ";
const gchar* full_debug_tokens = "adblock:match adblock:time startup bookmarks ";
if (debug_token == NULL)
{
gchar* found_token;

View file

@ -4230,7 +4230,7 @@ midori_view_set_uri (MidoriView* view,
g_warning ("Calling %s() before adding the view to a browser. This "
"breaks extensions that monitor page loading.", G_STRFUNC);
if (g_getenv ("MIDORI_UNARMED") == NULL)
if (!midori_debug ("unarmed"))
{
if (!uri || !strcmp (uri, "") || !strcmp (uri, "about:blank"))
{

View file

@ -12,6 +12,7 @@
#include "midori-websettings.h"
#include "midori-app.h"
#include "sokoke.h"
#include <midori/midori-core.h> /* Vala API */
@ -581,8 +582,7 @@ midori_web_settings_has_plugin_support (void)
#if !WEBKIT_CHECK_VERSION (1, 8, 2) && defined G_OS_WIN32
return FALSE;
#else
return g_getenv ("MIDORI_UNARMED") == NULL
&& g_strcmp0 (g_getenv ("MOZ_PLUGIN_PATH"), "/");
return !midori_debug ("unarmed") && g_strcmp0 (g_getenv ("MOZ_PLUGIN_PATH"), "/");
#endif
}