[lasem] debug: implement debug level for each category.



commit 6536822afc2bc8f3b77fb82fedd48422a711908b
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Mon May 9 11:02:01 2011 +0200

    debug: implement debug level for each category.

 docs/reference/lasem/lasem-sections.txt |    1 -
 src/lasemrender.c                       |    6 +-
 src/lsmattributes.c                     |    2 +-
 src/lsmdebug.c                          |  104 +++++++++++++++++++++++++------
 src/lsmdebug.h                          |   49 +++++++++++++-
 src/lsmdomcharacterdata.c               |    2 +-
 src/lsmdomdocument.c                    |    6 +-
 src/lsmdomimplementation.c              |    2 +-
 src/lsmdomnode.c                        |    8 +-
 src/lsmdomparser.c                      |    2 +-
 src/lsmdomview.c                        |   12 +---
 src/lsmdomview.h                        |    4 -
 src/lsmmathmldocument.c                 |    4 +-
 src/lsmmathmlelement.c                  |   22 +++---
 src/lsmmathmlitexelement.c              |    4 +-
 src/lsmmathmloperatorelement.c          |    8 +-
 src/lsmmathmlradicalelement.c           |    6 +-
 src/lsmmathmlunderoverelement.c         |   16 +++---
 src/lsmmathmlview.c                     |   33 +++++-----
 src/lsmproperties.c                     |    8 +-
 src/lsmsvgcircleelement.c               |    2 +-
 src/lsmsvgclippathelement.c             |    2 +-
 src/lsmsvgdocument.c                    |    2 +-
 src/lsmsvgelement.c                     |   12 ++--
 src/lsmsvgfilterelement.c               |    6 +-
 src/lsmsvggradientelement.c             |    2 +-
 src/lsmsvgimageelement.c                |    2 +-
 src/lsmsvglineargradientelement.c       |   14 ++---
 src/lsmsvglineelement.c                 |    2 +-
 src/lsmsvgmarkerelement.c               |    8 +-
 src/lsmsvgmaskelement.c                 |   10 ++--
 src/lsmsvgpathelement.c                 |    2 +-
 src/lsmsvgpatternelement.c              |   22 +++----
 src/lsmsvgradialgradientelement.c       |   14 ++---
 src/lsmsvgstopelement.c                 |    2 +-
 src/lsmsvgsvgelement.c                  |    4 +-
 src/lsmsvgtspanelement.c                |    2 +-
 src/lsmsvguseelement.c                  |   14 ++--
 src/lsmsvgview.c                        |   44 +++++++-------
 tests/lsmtest.c                         |    2 -
 40 files changed, 274 insertions(+), 193 deletions(-)
---
diff --git a/docs/reference/lasem/lasem-sections.txt b/docs/reference/lasem/lasem-sections.txt
index 6602c4e..b1c9470 100644
--- a/docs/reference/lasem/lasem-sections.txt
+++ b/docs/reference/lasem/lasem-sections.txt
@@ -175,7 +175,6 @@ LsmDomView
 lsm_dom_view_render
 lsm_dom_view_get_size
 lsm_dom_view_get_size_pixels
-lsm_dom_view_set_debug
 <SUBSECTION Standard>
 LsmDomViewClass
 LSM_DOM_VIEW
diff --git a/src/lasemrender.c b/src/lasemrender.c
index a3bca40..ab0119c 100644
--- a/src/lasemrender.c
+++ b/src/lasemrender.c
@@ -168,7 +168,7 @@ int main(int argc, char **argv)
 	}
 
 	if (document != NULL) {
-		if (lsm_debug_check ("dom")) {
+		if (lsm_debug_check (&lsm_debug_category_dom, LSM_DEBUG_LEVEL_LOG)) {
 			void *buffer;
 			int size;
 
@@ -184,8 +184,6 @@ int main(int argc, char **argv)
 
 		view = lsm_dom_document_create_view (document);
 
-		lsm_dom_view_set_debug (view, lsm_debug_check ("view"));
-
 		width_pt = 2.0;
 		height_pt = 2.0;
 
@@ -233,7 +231,7 @@ int main(int argc, char **argv)
 
 		g_object_unref (document);
 
-		lsm_debug ("render", "width = %g pt, height = %g pt",  width_pt, height_pt);
+		lsm_debug_render ("width = %g pt, height = %g pt",  width_pt, height_pt);
 	} else
 		g_warning (_("Can't load %s"), input_filename);
 
diff --git a/src/lsmattributes.c b/src/lsmattributes.c
index 013528c..21caf29 100644
--- a/src/lsmattributes.c
+++ b/src/lsmattributes.c
@@ -149,7 +149,7 @@ lsm_attribute_manager_set_attribute (LsmAttributeManager *manager,
 			g_free (attribute->value);
 			attribute->value = NULL;
 
-			lsm_debug ("dom", "[LsmAttributeManager::set_attribute] Invalid attribute value %s='%s'",
+			lsm_debug_dom ("[LsmAttributeManager::set_attribute] Invalid attribute value %s='%s'",
 				   name, value);
 		} else
 			return TRUE;
diff --git a/src/lsmdebug.c b/src/lsmdebug.c
index d28e24c..a885cce 100644
--- a/src/lsmdebug.c
+++ b/src/lsmdebug.c
@@ -1,6 +1,6 @@
 /* Lasem - SVG and Mathml library
  *
- * Copyright © 2010 Emmanuel Pacaud
+ * Copyright © 2010-2011 Emmanuel Pacaud
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,49 +25,113 @@
 #include <glib/gprintf.h>
 #include <stdlib.h>
 
-static GHashTable *lsm_debug_domains = NULL;
+LsmDebugCategory lsm_debug_category_dom =
+{
+	.name = "dom",
+	.level = -1
+};
+
+LsmDebugCategory lsm_debug_category_measure =
+{
+	.name = "measure",
+	.level = -1
+};
+
+LsmDebugCategory lsm_debug_category_update =
+{
+	.name = "update",
+	.level = -1
+};
+
+LsmDebugCategory lsm_debug_category_render =
+{
+	.name = "render",
+	.level = -1
+};
+
+static GHashTable *lsm_debug_categories = NULL;
+
+static void
+lsm_debug_category_free (LsmDebugCategory *category)
+{
+	if (category != NULL) {
+		g_free (category->name);
+		g_free (category);
+	}
+}
 
 static void
 lsm_debug_initialize (const char *debug_var)
 {
-	if (lsm_debug_domains != NULL)
+	if (lsm_debug_categories != NULL)
 		return;
 
-	lsm_debug_domains = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+	lsm_debug_categories = g_hash_table_new_full (g_str_hash, g_str_equal,
+						      (GDestroyNotify) lsm_debug_category_free, NULL);
 
 	if (debug_var != NULL) {
-		char **domains;
+		char **categories;
 		int i;
 
-		domains = g_strsplit (debug_var, ":", -1);
-		for (i = 0; domains[i] != NULL; i++) {
-			char *debug_domain;
+		categories = g_strsplit (debug_var, ",", -1);
+		for (i = 0; categories[i] != NULL; i++) {
+			LsmDebugCategory *category;
+			char **infos;
+
+			category = g_new0 (LsmDebugCategory, 1);
 
-			debug_domain = g_strdup (domains[i]);
-			g_hash_table_insert (lsm_debug_domains, debug_domain, debug_domain);
+			infos = g_strsplit (categories[i], ":", -1);
+			if (infos[0] != NULL) {
+				category->name = g_strdup (infos[0]);
+				if (infos[1] != NULL)
+					category->level = atoi (infos[1]);
+				else
+					category->level = LSM_DEBUG_LEVEL_DEBUG;
+
+				g_hash_table_insert (lsm_debug_categories, category->name, category);
+			} else
+				g_free (category);
+
+			g_strfreev (infos);
 		}
-		g_strfreev (domains);
+		g_strfreev (categories);
 	}
 }
 
 gboolean
-lsm_debug_check (const char *domain)
+lsm_debug_check	(LsmDebugCategory *category, LsmDebugLevel level)
 {
-	if (domain == NULL)
+	LsmDebugCategory *configured_category;
+
+	if (category == NULL)
 		return FALSE;
 
-	if (lsm_debug_domains == NULL)
-		lsm_debug_initialize (g_getenv ("LSM_DEBUG"));
+	if ((int) level <= (int) category->level)
+		return TRUE;
+
+	if ((int) category->level >= 0)
+		return FALSE;
+
+	lsm_debug_initialize (g_getenv ("LSM_DEBUG"));
+
+	configured_category = g_hash_table_lookup (lsm_debug_categories, category->name);
+	if (configured_category == NULL)
+		configured_category = g_hash_table_lookup (lsm_debug_categories, "all");
+	if (configured_category != NULL)
+		category->level = configured_category->level;
+	else
+		category->level = 0;
+
 
-	return g_hash_table_lookup (lsm_debug_domains, domain) != NULL;
+	return (int) level <= (int) category->level;
 }
 
 void
-lsm_debug (const char *domain, char const *format, ...)
+lsm_debug_with_level (LsmDebugCategory *category, LsmDebugLevel level, const char *format, ...)
 {
 	va_list args;
 
-	if (!lsm_debug_check (domain))
+	if (!lsm_debug_check (category, level))
 		return;
 
 	va_start (args, format);
@@ -77,7 +141,7 @@ lsm_debug (const char *domain, char const *format, ...)
 }
 
 void
-lsm_debug_enable (const char *domains)
+lsm_debug_enable (const char *categories)
 {
-	lsm_debug_initialize (domains);
+	lsm_debug_initialize (categories);
 }
diff --git a/src/lsmdebug.h b/src/lsmdebug.h
index 3db44b7..73f2d08 100644
--- a/src/lsmdebug.h
+++ b/src/lsmdebug.h
@@ -1,6 +1,6 @@
 /* Lasem - SVG and Mathml library
  *
- * Copyright © 2010 Emmanuel Pacaud
+ * Copyright © 2010-2011 Emmanuel Pacaud
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -28,9 +28,50 @@
 
 G_BEGIN_DECLS
 
-void 		lsm_debug 			(const char *domain, char const *format, ...);
-gboolean 	lsm_debug_check 		(const char *domain);
-void 		lsm_debug_enable 		(const char *domains);
+typedef enum {
+	LSM_DEBUG_LEVEL_NONE,
+	LSM_DEBUG_LEVEL_WARNING,
+	LSM_DEBUG_LEVEL_DEBUG,
+	LSM_DEBUG_LEVEL_LOG,
+	LSM_DEBUG_LEVEL_COUNT
+} LsmDebugLevel;
+
+typedef struct {
+	char *name;
+	LsmDebugLevel level;
+} LsmDebugCategory;
+
+extern LsmDebugCategory lsm_debug_category_dom;
+extern LsmDebugCategory lsm_debug_category_measure;
+extern LsmDebugCategory lsm_debug_category_update;
+extern LsmDebugCategory lsm_debug_category_render;
+
+#define lsm_debug_dom(...) 		lsm_debug (&lsm_debug_category_dom, __VA_ARGS__)
+#define lsm_log_dom(...)		lsm_log (&lsm_debug_category_dom, __VA_ARGS__)
+#define lsm_warning_dom(...)		lsm_warning (&lsm_debug_category_dom, __VA_ARGS__)
+
+#define lsm_debug_measure(...) 		lsm_debug (&lsm_debug_category_measure, __VA_ARGS__)
+#define lsm_log_measure(...)		lsm_log (&lsm_debug_category_measure, __VA_ARGS__)
+#define lsm_warning_measure(...)	lsm_warning (&lsm_debug_category_measure, __VA_ARGS__)
+
+#define lsm_debug_update(...) 		lsm_debug (&lsm_debug_category_update, __VA_ARGS__)
+#define lsm_log_update(...)		lsm_log (&lsm_debug_category_update, __VA_ARGS__)
+#define lsm_warning_update(...)		lsm_warning (&lsm_debug_category_update, __VA_ARGS__)
+
+#define lsm_debug_render(...) 		lsm_debug (&lsm_debug_category_render, __VA_ARGS__)
+#define lsm_log_render(...)		lsm_log (&lsm_debug_category_render, __VA_ARGS__)
+#define lsm_warning_render(...)		lsm_warning (&lsm_debug_category_render, __VA_ARGS__)
+
+#define lsm_warning(c,...)		lsm_debug_with_level ((c), LSM_DEBUG_LEVEL_WARNING, __VA_ARGS__)
+#define lsm_debug(c,...)		lsm_debug_with_level (c, LSM_DEBUG_LEVEL_DEBUG, __VA_ARGS__)
+#define lsm_log(c,...)			lsm_debug_with_level ((c), LSM_DEBUG_LEVEL_LOG, __VA_ARGS__)
+
+void		lsm_debug_with_level		(LsmDebugCategory *category, LsmDebugLevel level,
+						 const char *format, ...);
+
+gboolean	lsm_debug_check			(LsmDebugCategory *category, LsmDebugLevel level);
+
+void		lsm_debug_enable		(const char *category_selection);
 
 G_END_DECLS
 
diff --git a/src/lsmdomcharacterdata.c b/src/lsmdomcharacterdata.c
index bfa043f..dacd363 100644
--- a/src/lsmdomcharacterdata.c
+++ b/src/lsmdomcharacterdata.c
@@ -74,7 +74,7 @@ lsm_dom_character_data_set_data (LsmDomCharacterData* self, const char * value)
 	g_free (self->data);
 	self->data = g_strdup (value);
 
-	lsm_debug ("dom", "[LsmDomCharacterData::set_data] Value = '%s'", value);
+	lsm_debug_dom ("[LsmDomCharacterData::set_data] Value = '%s'", value);
 
 	lsm_dom_node_changed (LSM_DOM_NODE (self));
 }
diff --git a/src/lsmdomdocument.c b/src/lsmdomdocument.c
index b73fccd..a1efc50 100644
--- a/src/lsmdomdocument.c
+++ b/src/lsmdomdocument.c
@@ -167,7 +167,7 @@ lsm_dom_document_get_element_by_id (LsmDomDocument *self, const char *id)
 	g_return_val_if_fail (LSM_IS_DOM_DOCUMENT (self), NULL);
 	g_return_val_if_fail (id != NULL, NULL);
 
-	lsm_debug ("dom", "[LsmDomDocument::get_element_by_id] Lookup '%s'", id);
+	lsm_debug_dom ("[LsmDomDocument::get_element_by_id] Lookup '%s'", id);
 
 	return g_hash_table_lookup (self->ids, id);
 }
@@ -181,7 +181,7 @@ lsm_dom_document_register_element (LsmDomDocument *self, LsmDomElement *element,
 
 	old_id = g_hash_table_lookup (self->elements, element);
 	if (old_id != NULL) {
-		lsm_debug ("dom", "[LsmDomDocument::register_element] Unregister '%s'", old_id);
+		lsm_debug_dom ("[LsmDomDocument::register_element] Unregister '%s'", old_id);
 
 		g_hash_table_remove (self->elements, element);
 		g_hash_table_remove (self->ids, old_id);
@@ -190,7 +190,7 @@ lsm_dom_document_register_element (LsmDomDocument *self, LsmDomElement *element,
 	if (id != NULL) {
 		char *new_id = g_strdup (id);
 
-		lsm_debug ("dom", "[LsmDomDocument::register_element] Register '%s'", id);
+		lsm_debug_dom ("[LsmDomDocument::register_element] Register '%s'", id);
 
 		g_hash_table_replace (self->ids, new_id, element);
 		g_hash_table_replace (self->elements, element, new_id);
diff --git a/src/lsmdomimplementation.c b/src/lsmdomimplementation.c
index a5d3349..d0de878 100644
--- a/src/lsmdomimplementation.c
+++ b/src/lsmdomimplementation.c
@@ -54,7 +54,7 @@ lsm_dom_implementation_create_document (const char *namespace_uri,
 
 	create_function = g_hash_table_lookup (document_types, qualified_name);
 	if (create_function == NULL) {
-		lsm_debug ("dom", "[LsmDomImplementation::create_document] Unknow document type (%s)",
+		lsm_debug_dom ("[LsmDomImplementation::create_document] Unknow document type (%s)",
 			   qualified_name);
 		return NULL;
 	}
diff --git a/src/lsmdomnode.c b/src/lsmdomnode.c
index 242a3f1..ba087e1 100644
--- a/src/lsmdomnode.c
+++ b/src/lsmdomnode.c
@@ -345,7 +345,7 @@ lsm_dom_node_insert_before (LsmDomNode* self, LsmDomNode* new_child, LsmDomNode*
 	}
 
 	if (ref_child->parent_node != self) {
-		lsm_debug ("dom", "[LsmDomNode::insert_before] Ref child '%s' doesn't belong to '%s'",
+		lsm_debug_dom ("[LsmDomNode::insert_before] Ref child '%s' doesn't belong to '%s'",
 			   lsm_dom_node_get_node_name (ref_child),
 			   lsm_dom_node_get_node_name (self));
 		g_object_unref (new_child);
@@ -353,7 +353,7 @@ lsm_dom_node_insert_before (LsmDomNode* self, LsmDomNode* new_child, LsmDomNode*
 	}
 
 	if (!LSM_DOM_NODE_GET_CLASS (self)->can_append_child (self, new_child)) {
-		lsm_debug ("dom", "[LsmDomNode::insert_before] Can't append '%s' to '%s'",
+		lsm_debug_dom ("[LsmDomNode::insert_before] Can't append '%s' to '%s'",
 			   lsm_dom_node_get_node_name (new_child),
 			   lsm_dom_node_get_node_name (self));
 		g_object_unref (new_child);
@@ -418,7 +418,7 @@ lsm_dom_node_replace_child (LsmDomNode* self, LsmDomNode* new_child, LsmDomNode*
 		lsm_dom_node_remove_child (self, new_child);
 
 	if (old_child == NULL) {
-		lsm_debug ("dom", "[LsmDomNode::replace_child] old_child == NULL)");
+		lsm_debug_dom ("[LsmDomNode::replace_child] old_child == NULL)");
 		g_object_unref (new_child);
 		return NULL;
 	}
@@ -544,7 +544,7 @@ lsm_dom_node_append_child (LsmDomNode* self, LsmDomNode* new_child)
 		lsm_dom_node_remove_child (self, new_child);
 
 	if (!LSM_DOM_NODE_GET_CLASS (self)->can_append_child (self, new_child)) {
-		lsm_debug ("dom", "[LsmDomNode::append_child] Can't append '%s' to '%s'",
+		lsm_debug_dom ("[LsmDomNode::append_child] Can't append '%s' to '%s'",
 			   lsm_dom_node_get_node_name (new_child),
 			   lsm_dom_node_get_node_name (self));
 		g_object_unref (new_child);
diff --git a/src/lsmdomparser.c b/src/lsmdomparser.c
index 56ae64b..36e0631 100644
--- a/src/lsmdomparser.c
+++ b/src/lsmdomparser.c
@@ -292,7 +292,7 @@ lsm_dom_document_new_from_memory (const void *buffer, int size, GError **error)
 			g_object_unref (state.document);
 		state.document = NULL;
 
-		lsm_debug ("dom", "[LsmDomParser::from_memory] Invalid document");
+		lsm_debug_dom ("[LsmDomParser::from_memory] Invalid document");
 
 		g_set_error (error,
 			     LSM_DOM_DOCUMENT_ERROR,
diff --git a/src/lsmdomview.c b/src/lsmdomview.c
index 8dc3950..2641849 100644
--- a/src/lsmdomview.c
+++ b/src/lsmdomview.c
@@ -154,21 +154,13 @@ lsm_dom_view_render (LsmDomView *view, cairo_t *cairo, double x, double y)
 
 	cairo_restore (view->cairo);
 
-	lsm_debug ("render", "[LsmDomView::render] cairo status = %s",
-		   cairo_status_to_string (cairo_status (view->cairo)));
+	lsm_debug_render ("[LsmDomView::render] cairo status = %s",
+			  cairo_status_to_string (cairo_status (view->cairo)));
 
 	lsm_dom_view_set_cairo_context (view, NULL);
 }
 
 void
-lsm_dom_view_set_debug (LsmDomView *view, gboolean debug)
-{
-	g_return_if_fail (LSM_IS_DOM_VIEW (view));
-
-	view->debug = debug;
-}
-
-void
 lsm_dom_view_set_document (LsmDomView *view, LsmDomDocument *document)
 {
 	g_return_if_fail (LSM_IS_DOM_VIEW (view));
diff --git a/src/lsmdomview.h b/src/lsmdomview.h
index 15bd6c2..abfd6b3 100644
--- a/src/lsmdomview.h
+++ b/src/lsmdomview.h
@@ -49,8 +49,6 @@ struct _LsmDomView {
 	PangoLayout *		measure_pango_layout;
 	cairo_t *		cairo;
 	gboolean		is_vector;
-
-	gboolean debug;
 };
 
 struct _LsmDomViewClass {
@@ -70,8 +68,6 @@ void 			lsm_dom_view_get_size_pixels 	(LsmDomView *view, unsigned int *width, un
 
 void 			lsm_dom_view_set_document 	(LsmDomView *view, LsmDomDocument *document);
 
-void			lsm_dom_view_set_debug 		(LsmDomView *view, gboolean debug);
-
 G_END_DECLS
 
 #endif
diff --git a/src/lsmmathmldocument.c b/src/lsmmathmldocument.c
index 1f8003c..5d66f3f 100644
--- a/src/lsmmathmldocument.c
+++ b/src/lsmmathmldocument.c
@@ -128,7 +128,7 @@ lsm_mathml_document_create_element (LsmDomDocument *document, const char *tag_na
 	else if (strcmp (tag_name, "lasem:itex") == 0)
 		node = lsm_mathml_itex_element_new ();
 	else
-		lsm_debug ("dom", "[MathmlDocument::create_element] Unknown tag (%s)", tag_name);
+		lsm_debug_dom ("[MathmlDocument::create_element] Unknown tag (%s)", tag_name);
 
 	return LSM_DOM_ELEMENT (node);
 }
@@ -205,7 +205,7 @@ lsm_mathml_document_new_from_itex (const char *itex, int size, GError **error)
 	xml = itex2MML_parse (itex, size);
 
 	if (xml == NULL) {
-		lsm_debug ("dom", "[LsmMathmlDocument::new_from_itex] Invalid document");
+		lsm_debug_dom ("[LsmMathmlDocument::new_from_itex] Invalid document");
 
 		g_set_error (error,
 			     LSM_MATHML_DOCUMENT_ERROR,
diff --git a/src/lsmmathmlelement.c b/src/lsmmathmlelement.c
index a125a10..b7fb0ff 100644
--- a/src/lsmmathmlelement.c
+++ b/src/lsmmathmlelement.c
@@ -117,8 +117,8 @@ lsm_mathml_element_update (LsmMathmlElement *self, const LsmMathmlStyle *parent_
 	g_return_val_if_fail (parent_style != NULL, FALSE);
 
 	if (!self->need_update && !self->need_children_update) {
-		lsm_debug ("update", "[Element::update] %s already up to date",
-			    lsm_dom_node_get_node_name (LSM_DOM_NODE (self)));
+		lsm_debug_update ("[Element::update] %s already up to date",
+				  lsm_dom_node_get_node_name (LSM_DOM_NODE (self)));
 		return FALSE;
 	}
 
@@ -130,10 +130,10 @@ lsm_mathml_element_update (LsmMathmlElement *self, const LsmMathmlStyle *parent_
 	if (element_class->update != NULL)
 		element_class->update (self, style);
 
-	lsm_debug ("update", "[Element::update] update %s (%s-%g)",
-		    lsm_dom_node_get_node_name (LSM_DOM_NODE (self)),
-		    style->math_family != NULL ? style->math_family : "undefined" ,
-		    style->math_size);
+	lsm_debug_update ("[Element::update] update %s (%s-%g)",
+			  lsm_dom_node_get_node_name (LSM_DOM_NODE (self)),
+			  style->math_family != NULL ? style->math_family : "undefined" ,
+			  style->math_size);
 
 	g_free (self->style.math_family);
 	self->style.math_family = g_strdup (style->math_family);
@@ -204,7 +204,7 @@ _measure (LsmMathmlElement *self, LsmMathmlView *view, const LsmMathmlBbox *bbox
 	}
 
 	if (stretchy_found) {
-		lsm_debug ("measure", "[Element::_measure] Stretchy found (width = %g, height = %g, depth = %g)",
+		lsm_debug_measure ("[Element::_measure] Stretchy found (width = %g, height = %g, depth = %g)",
 			    stretch_bbox.width, stretch_bbox.height, stretch_bbox.depth);
 
 		for (node = LSM_DOM_NODE (self)->first_child; node != NULL; node = node->next_sibling) {
@@ -241,12 +241,12 @@ lsm_mathml_element_measure (LsmMathmlElement *element, LsmMathmlView *view, cons
 		if (element_class->measure) {
 			element->bbox = *(element_class->measure (element, view, stretch_bbox));
 
-			lsm_debug ("measure", "[Element::measure] Bbox (%s) %g, %g, %g",
+			lsm_debug_measure ("[Element::measure] Bbox (%s) %g, %g, %g",
 				    lsm_dom_node_get_node_name (LSM_DOM_NODE (element)),
 				    element->bbox.width, element->bbox.height, element->bbox.depth);
 		} else {
 
-			lsm_debug ("measure", "[Element::measure] method not defined");
+			lsm_debug_measure ("[Element::measure] method not defined");
 			element->bbox.width = 0.0;
 			element->bbox.height = 0.0;
 			element->bbox.depth = 0.0;
@@ -255,7 +255,7 @@ lsm_mathml_element_measure (LsmMathmlElement *element, LsmMathmlView *view, cons
 		element->need_measure = FALSE;
 		element->need_layout = TRUE;
 	} else
-		lsm_debug ("measure", "[Element::measure] %s already up to date",
+		lsm_debug_measure ("[Element::measure] %s already up to date",
 			    lsm_dom_node_get_node_name (LSM_DOM_NODE (element)));
 
 	return &element->bbox;
@@ -299,7 +299,7 @@ lsm_mathml_element_layout (LsmMathmlElement *self, LsmMathmlView *view,
 
 	g_return_if_fail (element_class != NULL);
 
-	lsm_debug ("measure", "[Element::layout] assigned bbox for %s = %g, %g, %g at %g, %g",
+	lsm_debug_measure ("[Element::layout] assigned bbox for %s = %g, %g, %g at %g, %g",
 		    lsm_dom_node_get_node_name (LSM_DOM_NODE (self)), bbox->width, bbox->height, bbox->depth, x , y);
 
 	self->x = x;
diff --git a/src/lsmmathmlitexelement.c b/src/lsmmathmlitexelement.c
index 74e6dd3..0de5d54 100644
--- a/src/lsmmathmlitexelement.c
+++ b/src/lsmmathmlitexelement.c
@@ -69,7 +69,7 @@ _update (LsmMathmlElement *self, LsmMathmlStyle *style)
 
 	need_conversion = g_strcmp0 (itex_element->itex, string->str) != 0;
 
-	lsm_debug ("update", "[MathmlItex::update] itex = '%s'", itex_element->itex);
+	lsm_debug_update ("[MathmlItex::update] itex = '%s'", itex_element->itex);
 
 	if (need_conversion) {
 		LsmMathmlDocument *document;
@@ -77,7 +77,7 @@ _update (LsmMathmlElement *self, LsmMathmlStyle *style)
 		g_free (itex_element->itex);
 		itex_element->itex = string->str;
 
-		lsm_debug ("update", "[MathmlItex::update] need conversion");
+		lsm_debug_update ("[MathmlItex::update] need conversion");
 
 		document = lsm_mathml_document_new_from_itex (itex_element->itex,
 							      string->len, NULL);
diff --git a/src/lsmmathmloperatorelement.c b/src/lsmmathmloperatorelement.c
index b85d436..adbbb77 100644
--- a/src/lsmmathmloperatorelement.c
+++ b/src/lsmmathmloperatorelement.c
@@ -81,7 +81,7 @@ lsm_mathml_operator_element_post_new_child (LsmDomNode *self, LsmDomNode *child)
 
 	entry = lsm_mathml_operator_element_dictionary_lookup (operator_element);
 
-	lsm_debug ("dom", "[OperatorElement::post_new_child] found %s %s",
+	lsm_debug_dom ("[OperatorElement::post_new_child] found %s %s",
 		    lsm_mathml_form_to_string (entry->form), entry->name);
 
 	lsm_mathml_boolean_attribute_inherit (&operator_element->stretchy, entry->stretchy);
@@ -102,7 +102,7 @@ lsm_mathml_operator_element_update (LsmMathmlElement *self, LsmMathmlStyle *styl
 
 	entry = lsm_mathml_operator_element_dictionary_lookup (operator_element);
 
-	lsm_debug ("update", "[OperatorElement::update] found %s %s",
+	lsm_debug_update ("[OperatorElement::update] found %s %s",
 		    lsm_mathml_form_to_string (entry->form), entry->name);
 
 	space = entry->left_space;
@@ -114,7 +114,7 @@ lsm_mathml_operator_element_update (LsmMathmlElement *self, LsmMathmlStyle *styl
 	lsm_mathml_boolean_attribute_inherit (&operator_element->accent, entry->accent);
 
 	if (operator_element->accent.value)
-		lsm_debug ("update", "[OperatorElement::update] Is accent");
+		lsm_debug_update ("[OperatorElement::update] Is accent");
 
 	lsm_mathml_boolean_attribute_inherit (&operator_element->large_op, entry->large_op);
 	lsm_mathml_boolean_attribute_inherit (&operator_element->movable_limits, entry->movable_limits);
@@ -128,7 +128,7 @@ lsm_mathml_operator_element_update (LsmMathmlElement *self, LsmMathmlStyle *styl
 	operator_element->is_large_op = operator_element->large_op.value &&
 		(style->display == LSM_MATHML_DISPLAY_BLOCK);
 	if (operator_element->is_large_op)
-		lsm_debug ("update", "[OperatorElement::update] Large op");
+		lsm_debug_update ("[OperatorElement::update] Large op");
 }
 
 static const LsmMathmlBbox *
diff --git a/src/lsmmathmlradicalelement.c b/src/lsmmathmlradicalelement.c
index 58e4a53..241618c 100644
--- a/src/lsmmathmlradicalelement.c
+++ b/src/lsmmathmlradicalelement.c
@@ -125,7 +125,7 @@ lsm_mathml_radical_element_measure (LsmMathmlElement *self, LsmMathmlView *view,
 
 	lsm_mathml_bbox_add_horizontally (&self->bbox, &radical->bbox);
 
-	lsm_debug ("measure", "[LsmMathmlRadicalElement::measure] Radical bbox w = %g, h = %g, d = %g",
+	lsm_debug_measure ("[LsmMathmlRadicalElement::measure] Radical bbox w = %g, h = %g, d = %g",
 		    radical->bbox.width, radical->bbox.height, radical->bbox.depth);
 
 	if (radical->type == LSM_MATHML_RADICAL_ELEMENT_TYPE_ROOT) {
@@ -141,7 +141,7 @@ lsm_mathml_radical_element_measure (LsmMathmlElement *self, LsmMathmlView *view,
 			radical->radical_x_offset = child_bbox.width - x_offset;
 			self->bbox.width += radical->radical_x_offset;
 
-			lsm_debug ("measure", "[LsmMathmlRadicalElement::measure] y_offset = %g", y_offset);
+			lsm_debug_measure ("[LsmMathmlRadicalElement::measure] y_offset = %g", y_offset);
 
 			height = self->bbox.height - y_offset + child_bbox.height + child_bbox.depth;
 			if (height > self->bbox.height)
@@ -149,7 +149,7 @@ lsm_mathml_radical_element_measure (LsmMathmlElement *self, LsmMathmlView *view,
 
 			radical->order_y_offset = - self->bbox.height + child_bbox.height;
 
-			lsm_debug ("measure", "[LsmMathmlRadicalElement::measure] order_y_offset = %g",
+			lsm_debug_measure ("[LsmMathmlRadicalElement::measure] order_y_offset = %g",
 				    radical->order_y_offset);
 		}
 	}
diff --git a/src/lsmmathmlunderoverelement.c b/src/lsmmathmlunderoverelement.c
index 541c962..f7ef484 100644
--- a/src/lsmmathmlunderoverelement.c
+++ b/src/lsmmathmlunderoverelement.c
@@ -152,7 +152,7 @@ lsm_mathml_under_over_element_update_children (LsmMathmlElement *self, LsmMathml
 		operator = lsm_mathml_element_get_embellished_core (under_over->underscript);
 		if (operator != NULL) {
 			accent_under = operator->accent.value;
-			lsm_debug ("update", "[UnderOver::update] Underscript is%s accent (%s)",
+			lsm_debug_update ("[UnderOver::update] Underscript is%s accent (%s)",
 				    accent_under ? "" : " not",
 				    lsm_dom_node_get_node_name (LSM_DOM_NODE (operator)));
 		}
@@ -173,7 +173,7 @@ lsm_mathml_under_over_element_update_children (LsmMathmlElement *self, LsmMathml
 		if (operator != NULL) {
 			accent = operator->accent.value;
 			if (accent)
-				lsm_debug ("update", "[UnderOver::update] Overscript is%s accent (%s)",
+				lsm_debug_update ("[UnderOver::update] Overscript is%s accent (%s)",
 					    accent ? "" : " not",
 					    lsm_dom_node_get_node_name (LSM_DOM_NODE (operator)));
 		}
@@ -195,7 +195,7 @@ lsm_mathml_under_over_element_update_children (LsmMathmlElement *self, LsmMathml
 		operator = lsm_mathml_element_get_embellished_core (under_over->base);
 		if (operator != NULL) {
 			movable_limits = operator->movable_limits.value;
-			lsm_debug ("update", "[UnderOver::update] movable_limits found");
+			lsm_debug_update ("[UnderOver::update] movable_limits found");
 		}
 	}
 
@@ -204,7 +204,7 @@ lsm_mathml_under_over_element_update_children (LsmMathmlElement *self, LsmMathml
 
 	under_over->as_script = under_over->display == LSM_MATHML_DISPLAY_INLINE && movable_limits;
 
-	lsm_debug ("update", "[UnderOver::update] space under = %g, over = %g",
+	lsm_debug_update ("[UnderOver::update] space under = %g, over = %g",
 		    under_over->under_space, under_over->over_space);
 
 	return need_measure;
@@ -247,7 +247,7 @@ lsm_mathml_under_over_element_measure (LsmMathmlElement *self, LsmMathmlView *vi
 	regular_stretch_bbox = lsm_mathml_bbox_null;
 	operator_stretch_bbox = lsm_mathml_bbox_null;
 
-	lsm_debug ("measure", "[UnderOver::measure] Begin");
+	lsm_debug_measure ("[UnderOver::measure] Begin");
 
 	index = 0;
 	for (node = LSM_DOM_NODE (self)->first_child; node != NULL; node = node->next_sibling) {
@@ -277,11 +277,11 @@ lsm_mathml_under_over_element_measure (LsmMathmlElement *self, LsmMathmlView *vi
 
 	if (stretchy_found) {
 		if (all_stretchy) {
-			lsm_debug ("measure", "[UnderOver::measure] All stretchy");
+			lsm_debug_measure ("[UnderOver::measure] All stretchy");
 			regular_stretch_bbox = operator_stretch_bbox;
 		}
 
-		lsm_debug ("measure", "[UnderOver::measure] Stretchy found (width = %g, height = %g, depth = %g)",
+		lsm_debug_measure ("[UnderOver::measure] Stretchy found (width = %g, height = %g, depth = %g)",
 			    regular_stretch_bbox.width,
 			    regular_stretch_bbox.height,
 			    regular_stretch_bbox.depth);
@@ -341,7 +341,7 @@ lsm_mathml_under_over_element_measure (LsmMathmlElement *self, LsmMathmlView *vi
 		self->bbox.depth += under_over->underscript_offset;
 	}
 
-	lsm_debug ("measure", "[UnderOver::measure] End");
+	lsm_debug_measure ("[UnderOver::measure] End");
 
 	return &self->bbox;
 }
diff --git a/src/lsmmathmlview.c b/src/lsmmathmlview.c
index 57b8a81..ced3d9e 100644
--- a/src/lsmmathmlview.c
+++ b/src/lsmmathmlview.c
@@ -130,7 +130,7 @@ lsm_mathml_view_show_layout (LsmMathmlView *view,
 			  const PangoRectangle *ink_rect,
 			  const PangoRectangle * rect)
 {
-	if (view->dom_view.debug) {
+	if (lsm_debug_check (&lsm_debug_category_render, LSM_DEBUG_LEVEL_DEBUG)) {
 		cairo_t *cairo;
 
 		cairo = view->dom_view.cairo;
@@ -186,7 +186,7 @@ lsm_mathml_view_measure_axis_offset (LsmMathmlView *view,
 
 	axis_offset = pango_units_to_double (- 0.5 * ink_rect.height - ink_rect.y + baseline);
 
-	lsm_debug ("measure", "[LsmMathmlView::measure_axis_offset] offset = %g (%g %%)",
+	lsm_debug_measure ("[LsmMathmlView::measure_axis_offset] offset = %g (%g %%)",
 		   axis_offset, axis_offset / math_size);
 
 	return axis_offset;
@@ -251,7 +251,7 @@ lsm_mathml_view_show_text (LsmMathmlView *view,
 	if (text == NULL || strlen (text) < 1)
 		return;
 
-	lsm_debug ("render", "[LsmMathmlView::show_text] '%s' at %g, %g (size = %g) %s",
+	lsm_debug_render ("[LsmMathmlView::show_text] '%s' at %g, %g (size = %g) %s",
 		   text, x, y, style->math_size,
 		   lsm_mathml_variant_to_string (style->math_variant));
 
@@ -267,7 +267,7 @@ lsm_mathml_view_show_text (LsmMathmlView *view,
 
 	cairo_save (cairo);
 
-	if (view->dom_view.debug) {
+	if (lsm_debug_check (&lsm_debug_category_dom, LSM_DEBUG_LEVEL_DEBUG)) {
 		cairo_set_source_rgba (cairo, 1.0, 0.0, 0.0, 0.2);
 		cairo_arc (cairo, x, y, 1.0, 0.0, 2.0 * M_PI);
 		cairo_fill (cairo);
@@ -350,7 +350,7 @@ lsm_mathml_view_measure_operator (LsmMathmlView *view,
 	pango_layout = view->dom_view.measure_pango_layout;
 
 	if (is_stretch_bbox_defined)
-		lsm_debug ("render", "[LsmMathmlView::measure_operator] Stretch bbox w = %g, h = %g, d = %g",
+		lsm_debug_render ("[LsmMathmlView::measure_operator] Stretch bbox w = %g, h = %g, d = %g",
 			   stretch_bbox->width, stretch_bbox->height, stretch_bbox->depth);
 
 	glyph = lsm_mathml_glyph_table_find_operator_glyph (text);
@@ -359,7 +359,7 @@ lsm_mathml_view_measure_operator (LsmMathmlView *view,
 							 pango_layout, &ink_rect, NULL, &baseline);
 		flags = 0;
 
-		lsm_debug ("render", "[LsmMathmlView::measure_operator] operator = %s", text);
+		lsm_debug_render ("[LsmMathmlView::measure_operator] operator = %s", text);
 
 	} else {
 		PangoLayoutIter *iter;
@@ -390,9 +390,8 @@ lsm_mathml_view_measure_operator (LsmMathmlView *view,
 			height = pango_units_to_double (ink_rect.height);
 			width = pango_units_to_double (ink_rect.width);
 
-			lsm_debug ("render",
-				   "[LsmMathmlView::measure_operator] Glyph #%i -> width = %g, height = %g", i,
-				    width, height);
+			lsm_debug_render ( "[LsmMathmlView::measure_operator] Glyph #%i -> width = %g, height = %g",
+					   i, width, height);
 
 			if (!is_stretch_bbox_defined) {
 				found = TRUE;
@@ -414,7 +413,7 @@ lsm_mathml_view_measure_operator (LsmMathmlView *view,
 		}
 
 		if (found)
-			lsm_debug ("render", "[LsmMathmlView::measure_operator] Found sized glyph #%i", i);
+			lsm_debug_render ("[LsmMathmlView::measure_operator] Found sized glyph #%i", i);
 
 		iter = pango_layout_get_iter (pango_layout);
 		baseline = pango_layout_iter_get_baseline (iter);
@@ -484,7 +483,7 @@ lsm_mathml_view_show_operator (LsmMathmlView *view,
 	pango_layout = view->dom_view.measure_pango_layout;
 
 	if (stretch_bbox->is_defined)
-		lsm_debug ("render", "[LsmMathmlView::show_operator] Stretch bbox w = %g, h = %g, d = %g",
+		lsm_debug_render ("[LsmMathmlView::show_operator] Stretch bbox w = %g, h = %g, d = %g",
 			   stretch_bbox->width, stretch_bbox->height, stretch_bbox->depth);
 
 	glyph = lsm_mathml_glyph_table_find_operator_glyph (text);
@@ -515,7 +514,7 @@ lsm_mathml_view_show_operator (LsmMathmlView *view,
 			pango_layout_set_font_description (pango_layout, font_description);
 			pango_layout_get_extents (pango_layout, &ink_rect, NULL);
 
-			lsm_debug ("render", "[LsmMathmlView::show_operator] Glyph #%i -> width = %g, height = %g", i,
+			lsm_debug_render ("[LsmMathmlView::show_operator] Glyph #%i -> width = %g, height = %g", i,
 				   pango_units_to_double (ink_rect.width),
 				   pango_units_to_double (ink_rect.height));
 
@@ -541,14 +540,14 @@ lsm_mathml_view_show_operator (LsmMathmlView *view,
 		}
 
 		if (found)
-			lsm_debug ("render", "[LsmMathmlView::show_operator] Found sized glyph #%i", i);
+			lsm_debug_render ("[LsmMathmlView::show_operator] Found sized glyph #%i", i);
 
 		iter = pango_layout_get_iter (pango_layout);
 		baseline = pango_layout_iter_get_baseline (iter);
 		pango_layout_iter_free (iter);
 	}
 
-	lsm_debug ("render", "[LsmMathmlView::show_operator] '%s' at %g, %g (size = %g) %s - %s",
+	lsm_debug_render ("[LsmMathmlView::show_operator] '%s' at %g, %g (size = %g) %s - %s",
 		    text, x, y, style->math_size,
 		    style->math_family,
 		    lsm_mathml_variant_to_string (style->math_variant));
@@ -563,7 +562,7 @@ lsm_mathml_view_show_operator (LsmMathmlView *view,
 
 	cairo_save (cairo);
 
-	if (view->dom_view.debug) {
+	if (lsm_debug_check (&lsm_debug_category_render, LSM_DEBUG_LEVEL_DEBUG)) {
 		cairo_set_source_rgba (cairo, 1.0, 0.0, 0.0, 0.1);
 		cairo_arc (cairo, x, y, 1.0, 0.0, 2.0 * M_PI);
 		cairo_fill (cairo);
@@ -837,7 +836,7 @@ lsm_mathml_view_show_bbox (LsmMathmlView *view, double x, double y, const LsmMat
 
 	cairo = view->dom_view.cairo;
 
-	if (view->dom_view.debug) {
+	if (lsm_debug_check (&lsm_debug_category_render, LSM_DEBUG_LEVEL_DEBUG)) {
 		cairo_move_to (cairo, x, y);
 		cairo_set_source_rgba (cairo, 0,0,1,0.1);
 		cairo_rectangle (cairo, x, y, bbox->width, -bbox->height);
@@ -990,7 +989,7 @@ lsm_mathml_view_render (LsmDomView *dom_view)
 
 	lsm_mathml_math_element_render (math_element, view);
 
-	lsm_debug ("render", "[LsmMathmlView::render] cairo status = %s",
+	lsm_debug_render ("[LsmMathmlView::render] cairo status = %s",
 		   cairo_status_to_string (cairo_status (cairo)));
 }
 
diff --git a/src/lsmproperties.c b/src/lsmproperties.c
index 3361831..ad6ee7f 100644
--- a/src/lsmproperties.c
+++ b/src/lsmproperties.c
@@ -110,8 +110,8 @@ _set_property (LsmPropertyManager *manager,
 
 		success = trait_class->from_string (PROPERTY_TRAIT (property), (char *) value);
 		if (!success) {
-			lsm_debug ("dom", "[LsmPropertyManager::set_property] Invalid property value %s='%s'",
-				   name, value);
+			lsm_debug_dom ("[LsmPropertyManager::set_property] Invalid property value %s='%s'",
+				       name, value);
 			property_free (property, property_infos->trait_class);
 
 			return FALSE;
@@ -177,8 +177,8 @@ lsm_property_manager_set_property (LsmPropertyManager *manager,
 					old_char = *end_ptr;
 					*end_ptr = '\0';
 
-					lsm_debug ("dom", "[LsmPropertyManager::set_property] inline_style %s = %s",
-						   name, value);
+					lsm_debug_dom ("[LsmPropertyManager::set_property] inline_style %s = %s",
+						       name, value);
 
 					_set_property (manager, property_bag, name, value);
 
diff --git a/src/lsmsvgcircleelement.c b/src/lsmsvgcircleelement.c
index 2e5b933..22f7094 100644
--- a/src/lsmsvgcircleelement.c
+++ b/src/lsmsvgcircleelement.c
@@ -48,7 +48,7 @@ lsm_svg_circle_element_render (LsmSvgElement *self, LsmSvgView *view)
 	cy = lsm_svg_view_normalize_length (view, &circle->cy.length, LSM_SVG_LENGTH_DIRECTION_VERTICAL);
 	r  = lsm_svg_view_normalize_length (view, &circle->r.length,  LSM_SVG_LENGTH_DIRECTION_DIAGONAL);
 
-	lsm_debug ("render", "[LsmSvgCircleElement::render] cx = %g, cy = %g, r = %g", cx, cy, r);
+	lsm_debug_render ("[LsmSvgCircleElement::render] cx = %g, cy = %g, r = %g", cx, cy, r);
 
 	lsm_svg_view_show_circle (view, cx, cy, r);
 }
diff --git a/src/lsmsvgclippathelement.c b/src/lsmsvgclippathelement.c
index 5677110..011b53b 100644
--- a/src/lsmsvgclippathelement.c
+++ b/src/lsmsvgclippathelement.c
@@ -46,7 +46,7 @@ lsm_svg_clip_path_element_render (LsmSvgElement *self, LsmSvgView *view)
 	LsmSvgStyle *style;
 
 	if (!clip->enable_rendering) {
-		lsm_debug ("render", "[LsmSvgClipPathElement::render] Direct rendering not allowed");
+		lsm_debug_render ("[LsmSvgClipPathElement::render] Direct rendering not allowed");
 		return;
 	} else {
 		clip->enable_rendering = FALSE;
diff --git a/src/lsmsvgdocument.c b/src/lsmsvgdocument.c
index b87271a..cc9f1f3 100644
--- a/src/lsmsvgdocument.c
+++ b/src/lsmsvgdocument.c
@@ -138,7 +138,7 @@ lsm_svg_document_create_element (LsmDomDocument *document, const char *tag_name)
 		node = lsm_svg_filter_gaussian_blur_new ();
 
 	if (node != NULL)
-		lsm_debug ("dom", "[LsmSvgDocument::create_element] Create a %s element", tag_name);
+		lsm_debug_dom ("[LsmSvgDocument::create_element] Create a %s element", tag_name);
 
 	return LSM_DOM_ELEMENT (node);
 }
diff --git a/src/lsmsvgelement.c b/src/lsmsvgelement.c
index 810fdc8..f92b9d4 100644
--- a/src/lsmsvgelement.c
+++ b/src/lsmsvgelement.c
@@ -66,7 +66,7 @@ lsm_svg_element_set_attribute (LsmDomElement *self, const char* name, const char
 	LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_GET_CLASS (self);
 	LsmSvgElement *s_element = LSM_SVG_ELEMENT (self);
 
-	lsm_debug ("dom", "[LsmSvgElement::set_attribute] node = %s, name = %s, value = %s",
+	lsm_debug_dom ("[LsmSvgElement::set_attribute] node = %s, name = %s, value = %s",
 		    lsm_dom_node_get_node_name (LSM_DOM_NODE (self)), name, value);
 
 	/* TODO Avoid double hash table lookup */
@@ -141,7 +141,7 @@ _render (LsmSvgElement *element, LsmSvgView *view)
 {
 	LsmDomNode *node;
 
-	lsm_debug ("render", "[LsmSvgElement::_render");
+	lsm_debug_render ("[LsmSvgElement::_render");
 
 	lsm_svg_view_push_group_opacity (view);
 
@@ -180,7 +180,7 @@ lsm_svg_element_render (LsmSvgElement *element, LsmSvgView *view)
 
 	if (style->visibility->value == LSM_SVG_VISIBILITY_VISIBLE &&
 	    style->display->value != LSM_SVG_DISPLAY_NONE) {
-		lsm_debug ("render", "[LsmSvgElement::render] Render %s (%s)",
+		lsm_debug_render ("[LsmSvgElement::render] Render %s (%s)",
 			   lsm_dom_node_get_node_name (LSM_DOM_NODE (element)),
 			   element->id.value != NULL ? element->id.value : "no id");
 
@@ -231,7 +231,7 @@ _get_extents (LsmSvgElement *element, LsmSvgView *view, LsmExtents *extents)
 	gboolean first_child = TRUE;
 	LsmExtents element_extents = {0.0, 0.0, 0.0, 0.0};
 
-	lsm_debug ("render", "[LsmSvgElement::_get_extents]");
+	lsm_debug_render ("[LsmSvgElement::_get_extents]");
 
 	for (node = LSM_DOM_NODE (element)->first_child; node != NULL; node = node->next_sibling) {
 		if (LSM_IS_SVG_ELEMENT (node)) {
@@ -276,11 +276,11 @@ lsm_svg_element_get_extents (LsmSvgElement *element, LsmSvgView *view, LsmExtent
 		element_class->get_extents (element, view, extents);
 
 		if (element->id.value != NULL)
-			lsm_debug ("measure", "LsmSvgElement::get_extents] Extents for '%s' = %g,%g %g,%g",
+			lsm_debug_measure ("LsmSvgElement::get_extents] Extents for '%s' = %g,%g %g,%g",
 				   element->id.value,
 				   extents->x1, extents->y1, extents->x2, extents->y2);
 		else
-			lsm_debug ("measure", "LsmSvgElement::get_extents] Extents for <%s> = %g,%g %g,%g",
+			lsm_debug_measure ("LsmSvgElement::get_extents] Extents for <%s> = %g,%g %g,%g",
 				   lsm_dom_node_get_node_name (LSM_DOM_NODE (element)),
 				   extents->x1, extents->y1, extents->x2, extents->y2);
 	} else {
diff --git a/src/lsmsvgfilterelement.c b/src/lsmsvgfilterelement.c
index fbf3cfa..ed11263 100644
--- a/src/lsmsvgfilterelement.c
+++ b/src/lsmsvgfilterelement.c
@@ -54,7 +54,7 @@ lsm_svg_filter_element_render (LsmSvgElement *self, LsmSvgView *view)
 	gboolean is_object_bounding_box;
 
 	if (!filter->enable_rendering) {
-		lsm_debug ("render", "[LsmSvgFilterElement::render] Direct rendering not allowed");
+		lsm_debug_render ("[LsmSvgFilterElement::render] Direct rendering not allowed");
 		return;
 	} else {
 		filter->enable_rendering = FALSE;
@@ -89,12 +89,12 @@ lsm_svg_filter_element_render (LsmSvgElement *self, LsmSvgView *view)
 	}
 
 	if (viewport.width <= 0.0 || viewport.height <= 0.0) {
-		lsm_debug ("render", "[LsmSvgFilterElement::render] Invalid filter area w = %g, h = %g",
+		lsm_debug_render ("[LsmSvgFilterElement::render] Invalid filter area w = %g, h = %g",
 			   viewport.width, viewport.height);
 		return;
 	}
 
-	lsm_debug ("render", "[LsmFilterElement::render] Render filter x = %g, y = %g, w = %g, h = %g",
+	lsm_debug_render ("[LsmFilterElement::render] Render filter x = %g, y = %g, w = %g, h = %g",
 		   viewport.x, viewport.y, viewport.width, viewport.height);
 
 	is_object_bounding_box = (filter->primitive_units.value == LSM_SVG_PATTERN_UNITS_OBJECT_BOUNDING_BOX);
diff --git a/src/lsmsvggradientelement.c b/src/lsmsvggradientelement.c
index 28f145b..22d6b4c 100644
--- a/src/lsmsvggradientelement.c
+++ b/src/lsmsvggradientelement.c
@@ -64,7 +64,7 @@ lsm_svg_gradient_element_render (LsmSvgElement *self, LsmSvgView *view)
 	if (referenced_gradient == NULL)
 		return;
 
-	lsm_debug ("render", "[LsmSvgElement::render] transform %g, %g, %g, %g, %g, %g",
+	lsm_debug_render ("[LsmSvgElement::render] transform %g, %g, %g, %g, %g, %g",
 		   gradient->transform.matrix.a,
 		   gradient->transform.matrix.b,
 		   gradient->transform.matrix.c,
diff --git a/src/lsmsvgimageelement.c b/src/lsmsvgimageelement.c
index 34fe043..4146d8d 100644
--- a/src/lsmsvgimageelement.c
+++ b/src/lsmsvgimageelement.c
@@ -108,7 +108,7 @@ lsm_svg_image_element_render (LsmSvgElement *self, LsmSvgView *view)
 	viewport.height = lsm_svg_view_normalize_length (view, &image->height.length,
 							 LSM_SVG_LENGTH_DIRECTION_VERTICAL);
 
-	lsm_debug ("render", "[LsmSvgImageElement::graphic_render] viewport %g, %g, %g, %g",
+	lsm_debug_render ("[LsmSvgImageElement::graphic_render] viewport %g, %g, %g, %g",
 		   viewport.x, viewport.y, viewport.width, viewport.height);
 
 	viewbox.x = 0;
diff --git a/src/lsmsvglineargradientelement.c b/src/lsmsvglineargradientelement.c
index a6f9c9a..530f456 100644
--- a/src/lsmsvglineargradientelement.c
+++ b/src/lsmsvglineargradientelement.c
@@ -84,16 +84,15 @@ lsm_svg_linear_gradient_element_inherit_referenced (LsmDomDocument *owner,
 
 		for (iter = *elements; iter != NULL; iter = iter->next)
 			if (iter->data == element) {
-				lsm_debug ("render", "[LsmSvgLinearGradientElement::inherit_attributes] "
+				lsm_debug_render ("[LsmSvgLinearGradientElement::inherit_attributes] "
 					   "Circular reference (id = %s)", id);
 				circular_reference_found = TRUE;
 			}
 
 		if (!circular_reference_found) {
 			if (LSM_IS_SVG_GRADIENT_ELEMENT (element)) {
-				lsm_debug ("render",
-					   "[LsmSvgLinearGradientElement::inherit_attributes]"
-					   " Found referenced element '%s'", id);
+				lsm_debug_render ("[LsmSvgLinearGradientElement::inherit_attributes]"
+						  " Found referenced element '%s'", id);
 
 				referenced_gradient = lsm_svg_linear_gradient_element_inherit_referenced
 					(owner,
@@ -101,9 +100,8 @@ lsm_svg_linear_gradient_element_inherit_referenced (LsmDomDocument *owner,
 					 attributes, elements);
 
 			} else {
-				lsm_debug ("render",
-					   "[LsmSvgLinearGradientElement::inherit_attributes]"
-					   " Referenced element '%s' not found", id);
+				lsm_debug_render ("[LsmSvgLinearGradientElement::inherit_attributes]"
+						  " Referenced element '%s' not found", id);
 				referenced_gradient = NULL;
 			}
 		} else
@@ -184,7 +182,7 @@ lsm_svg_linear_gradient_element_create_gradient (LsmSvgElement *self,
 	if (is_object_bounding_box)
 		lsm_svg_view_pop_viewbox (view);
 
-	lsm_debug ("render", "[LsmSvgLinearGradientElement::render] Create linear %g, %g, %g, %g",
+	lsm_debug_render ("[LsmSvgLinearGradientElement::render] Create linear %g, %g, %g, %g",
 		    x1, y1, x2, y2);
 
 	lsm_svg_view_create_linear_gradient (view, x1, y1, x2, y2);
diff --git a/src/lsmsvglineelement.c b/src/lsmsvglineelement.c
index a0e62bc..0eeedfd 100644
--- a/src/lsmsvglineelement.c
+++ b/src/lsmsvglineelement.c
@@ -49,7 +49,7 @@ lsm_svg_line_element_render (LsmSvgElement *self, LsmSvgView *view)
 	x2 = lsm_svg_view_normalize_length (view, &line->x2.length, LSM_SVG_LENGTH_DIRECTION_HORIZONTAL);
 	y2 = lsm_svg_view_normalize_length (view, &line->y2.length, LSM_SVG_LENGTH_DIRECTION_VERTICAL);
 
-	lsm_debug ("render", "[LsmSvgLineElement::render] %g, %g, %g, %g", x1, y1, x2, y2);
+	lsm_debug_render ("[LsmSvgLineElement::render] %g, %g, %g, %g", x1, y1, x2, y2);
 
 	lsm_svg_view_show_line (view, x1, y1, x2, y2);
 }
diff --git a/src/lsmsvgmarkerelement.c b/src/lsmsvgmarkerelement.c
index 8643551..d52b22e 100644
--- a/src/lsmsvgmarkerelement.c
+++ b/src/lsmsvgmarkerelement.c
@@ -53,7 +53,7 @@ _marker_element_render (LsmSvgElement *self, LsmSvgView *view)
 		if (marker->style)
 			lsm_svg_style_unref (marker->style);
 		marker->style = lsm_svg_style_ref (lsm_svg_view_get_current_style (view));
-		lsm_debug ("render", "[LsmSvgMarkerElement::render] Direct rendering not allowed");
+		lsm_debug_render ("[LsmSvgMarkerElement::render] Direct rendering not allowed");
 		return;
 	} else {
 		marker->enable_rendering = FALSE;
@@ -84,15 +84,15 @@ _marker_element_render (LsmSvgElement *self, LsmSvgView *view)
 	lsm_svg_view_viewbox_to_viewport (view, &viewport, &marker->viewbox.value,
 					  &marker->preserve_aspect_ratio.value, &ref_x, &ref_y);
 
-	lsm_debug ("render", "[LsmSvgMarkerElement::render] stroke_width scale = %g",
+	lsm_debug_render ("[LsmSvgMarkerElement::render] stroke_width scale = %g",
 		   marker->stroke_width);
 
 	if (marker->orientation.value.type == LSM_SVG_ANGLE_TYPE_FIXED) {
 		lsm_svg_matrix_init_rotate (&matrix, marker->orientation.value.angle);
-		lsm_debug ("render", "[LsmSvgMarkerElement::render] fixed angle = %g", marker->orientation.value.angle);
+		lsm_debug_render ("[LsmSvgMarkerElement::render] fixed angle = %g", marker->orientation.value.angle);
 	} else {
 		lsm_svg_matrix_init_rotate (&matrix, marker->vertex_angle);
-		lsm_debug ("render", "[LsmSvgMarkerElement::render] auto angle = %g", marker->vertex_angle);
+		lsm_debug_render ("[LsmSvgMarkerElement::render] auto angle = %g", marker->vertex_angle);
 	}
 	lsm_svg_matrix_translate (&matrix, -ref_x, -ref_y);
 	lsm_svg_view_push_matrix (view, &matrix);
diff --git a/src/lsmsvgmaskelement.c b/src/lsmsvgmaskelement.c
index a85f8d9..b35e0b8 100644
--- a/src/lsmsvgmaskelement.c
+++ b/src/lsmsvgmaskelement.c
@@ -47,7 +47,7 @@ lsm_svg_mask_element_render (LsmSvgElement *self, LsmSvgView *view)
 	LsmSvgStyle *style;
 
 	if (!mask->enable_rendering) {
-		lsm_debug ("render", "[LsmSvgMaskElement::render] Direct rendering not allowed");
+		lsm_debug_render ("[LsmSvgMaskElement::render] Direct rendering not allowed");
 		return;
 	} else {
 		mask->enable_rendering = FALSE;
@@ -85,7 +85,7 @@ lsm_svg_mask_element_render (LsmSvgElement *self, LsmSvgView *view)
 	}
 
 	if (viewport.width <= 0.0 || viewport.height <= 0.0) {
-		lsm_debug ("render", "[LsmSvgMaskElement::render] Invalid viewport w = %g, h = %g",
+		lsm_debug_render ("[LsmSvgMaskElement::render] Invalid viewport w = %g, h = %g",
 			   viewport.width, viewport.height);
 		lsm_svg_view_pop_style (view);
 		lsm_svg_style_unref (style);
@@ -95,13 +95,13 @@ lsm_svg_mask_element_render (LsmSvgElement *self, LsmSvgView *view)
 	if (!lsm_svg_view_create_surface_pattern (view, &viewport,
 						  NULL,
 						  LSM_SVG_VIEW_SURFACE_TYPE_IMAGE)) {
-		lsm_debug ("render", "[LsmSvgMaskElement::render] Intermediate surface creation failed");
+		lsm_debug_render ("[LsmSvgMaskElement::render] Intermediate surface creation failed");
 		lsm_svg_view_pop_style (view);
 		lsm_svg_style_unref (style);
 		return;
 	}
 
-	lsm_debug ("render", "[LsmSvgMaskElement::render] Create mask x = %g, y = %g, w = %g, h = %g",
+	lsm_debug_render ("[LsmSvgMaskElement::render] Create mask x = %g, y = %g, w = %g, h = %g",
 		   viewport.x, viewport.y, viewport.width, viewport.height);
 
 	is_object_bounding_box = (mask->content_units.value == LSM_SVG_PATTERN_UNITS_OBJECT_BOUNDING_BOX);
@@ -115,7 +115,7 @@ lsm_svg_mask_element_render (LsmSvgElement *self, LsmSvgView *view)
 		lsm_svg_view_push_viewbox (view, &viewbox);
 		lsm_svg_view_push_matrix (view, &matrix);
 
-		lsm_debug ("render", "[LsmSvgMaskElement::render] object_bounding_box"
+		lsm_debug_render ("[LsmSvgMaskElement::render] object_bounding_box"
 			   " x_scale = %g, y_scale = %g, x_offset = %g, y_offset = %g",
 			   mask_extents->width, mask_extents->height,
 			   mask_extents->x, mask_extents->y);
diff --git a/src/lsmsvgpathelement.c b/src/lsmsvgpathelement.c
index d5c3d2d..5dc6c7e 100644
--- a/src/lsmsvgpathelement.c
+++ b/src/lsmsvgpathelement.c
@@ -41,7 +41,7 @@ lsm_svg_path_element_render (LsmSvgElement *self, LsmSvgView *view)
 {
 	LsmSvgPathElement *path = LSM_SVG_PATH_ELEMENT (self);
 
-	lsm_debug ("render", "[LsmSvgPathElement::render]");
+	lsm_debug_render ("[LsmSvgPathElement::render]");
 
 	lsm_svg_view_show_path (view, path->d.value);
 }
diff --git a/src/lsmsvgpatternelement.c b/src/lsmsvgpatternelement.c
index 4cba96d..9cdca70 100644
--- a/src/lsmsvgpatternelement.c
+++ b/src/lsmsvgpatternelement.c
@@ -92,25 +92,23 @@ lsm_svg_pattern_element_inherit_referenced (LsmDomDocument *owner,
 
 		for (iter = *elements; iter != NULL; iter = iter->next)
 			if (iter->data == element) {
-				lsm_debug ("render", "[LsmSvgPatternElement::inherit_attributes] "
+				lsm_debug_render ("[LsmSvgPatternElement::inherit_attributes] "
 					   "Circular reference (id = %s)", id);
 				circular_reference_found = TRUE;
 			}
 
 		if (!circular_reference_found) {
 			if (LSM_IS_SVG_PATTERN_ELEMENT (element), elements) {
-				lsm_debug ("render",
-					   "[LsmSvgPatternElement::inherit_attributes] "
-					   "Found referenced element '%s'", id);
+				lsm_debug_render ("[LsmSvgPatternElement::inherit_attributes] "
+						  "Found referenced element '%s'", id);
 
 				referenced_pattern = lsm_svg_pattern_element_inherit_referenced
 					(owner,
 					 LSM_SVG_PATTERN_ELEMENT (element),
 					 attributes, elements);
 			} else {
-				lsm_debug ("render",
-					   "[LsmSvgPatternElement::inherit_attributes] "
-					   "Referenced element '%s' not found", id);
+				lsm_debug_render ("[LsmSvgPatternElement::inherit_attributes] "
+						  "Referenced element '%s' not found", id);
 				referenced_pattern = NULL;
 			}
 		} else
@@ -152,7 +150,7 @@ lsm_svg_pattern_element_render (LsmSvgElement *self, LsmSvgView *view)
 	LsmSvgStyle *style;
 
 	if (!pattern->enable_rendering) {
-		lsm_debug ("render", "[LsmSvgPatternElement::render] Direct rendering not allowed");
+		lsm_debug_render ("[LsmSvgPatternElement::render] Direct rendering not allowed");
 		return;
 	} else {
 		pattern->enable_rendering = FALSE;
@@ -220,20 +218,20 @@ lsm_svg_pattern_element_render (LsmSvgElement *self, LsmSvgView *view)
 	}
 
 	if (viewport.width <= 0.0 || viewport.height <= 0.0) {
-		lsm_debug ("render", "[LsmSvgPatternElement::render] Invalid viewport w = %g, h = %g",
+		lsm_debug_render ("[LsmSvgPatternElement::render] Invalid viewport w = %g, h = %g",
 			   viewport.width, viewport.height);
 		lsm_svg_view_pop_style (view);
 		lsm_svg_style_unref (style);
 		return;
 	}
 
-	lsm_debug ("render", "[LsmSvgPatternElement::render] Create pattern x = %g, y = %g, w = %g, h = %g",
+	lsm_debug_render ("[LsmSvgPatternElement::render] Create pattern x = %g, y = %g, w = %g, h = %g",
 		   viewport.x, viewport.y, viewport.width, viewport.height);
 
 	if (!lsm_svg_view_create_surface_pattern (view, &image_box,
 						  &pattern->transform.matrix,
 						  LSM_SVG_VIEW_SURFACE_TYPE_AUTO)) {
-		lsm_debug ("render", "[LsmSvgPatternElement::render] Intermediate surface creation failed");
+		lsm_debug_render ("[LsmSvgPatternElement::render] Intermediate surface creation failed");
 		lsm_svg_view_pop_style (view);
 		lsm_svg_style_unref (style);
 		return;
@@ -250,7 +248,7 @@ lsm_svg_pattern_element_render (LsmSvgElement *self, LsmSvgView *view)
 		lsm_svg_view_push_viewbox (view, &viewbox);
 		lsm_svg_view_push_matrix (view, &matrix);
 
-		lsm_debug ("render", "[LsmSvgPatternElement::render] object_bounding_box"
+		lsm_debug_render ("[LsmSvgPatternElement::render] object_bounding_box"
 			   " x_scale = %g, y_scale = %g, x_offset = %g, y_offset = %g",
 			   pattern_extents->width, pattern_extents->height,
 			   pattern_extents->x,     pattern_extents->y);
diff --git a/src/lsmsvgradialgradientelement.c b/src/lsmsvgradialgradientelement.c
index b15c537..9fe93d7 100644
--- a/src/lsmsvgradialgradientelement.c
+++ b/src/lsmsvgradialgradientelement.c
@@ -91,25 +91,23 @@ lsm_svg_radial_gradient_element_inherit_referenced (LsmDomDocument *owner,
 
 		for (iter = *elements; iter != NULL; iter = iter->next)
 			if (iter->data == element) {
-				lsm_debug ("render", "[LsmSvgRadialGradientElement::inherit_attributes] "
+				lsm_debug_render ("[LsmSvgRadialGradientElement::inherit_attributes] "
 					   "Circular reference (id = %s)", id);
 				circular_reference_found = TRUE;
 			}
 
 		if (!circular_reference_found) {
 			if (LSM_IS_SVG_GRADIENT_ELEMENT (element)) {
-				lsm_debug ("render",
-					   "[LsmSvgRadialGradientElement::inherit_attributes]"
-					   " Found referenced element '%s'", id);
+				lsm_debug_render ("[LsmSvgRadialGradientElement::inherit_attributes]"
+						  " Found referenced element '%s'", id);
 
 				referenced_gradient = lsm_svg_radial_gradient_element_inherit_referenced
 					(owner,
 					 LSM_SVG_GRADIENT_ELEMENT (element),
 					 attributes, elements);
 			} else {
-				lsm_debug ("render",
-					   "[LsmSvgRadialGradientElement::inherit_attributes]"
-					   " Referenced element '%s' not found", id);
+				lsm_debug_render ("[LsmSvgRadialGradientElement::inherit_attributes]"
+						  " Referenced element '%s' not found", id);
 				referenced_gradient = NULL;
 			}
 		} else
@@ -229,7 +227,7 @@ lsm_svg_radial_gradient_element_create_gradient (LsmSvgElement *self,
 	if (is_object_bounding_box)
 		lsm_svg_view_pop_viewbox (view);
 
-	lsm_debug ("render", "[LsmSvgRadialElement::render] cx = %g, cy = %g, r = %g, fx = %g, fy = %g",
+	lsm_debug_render ("[LsmSvgRadialElement::render] cx = %g, cy = %g, r = %g, fx = %g, fy = %g",
 		    cx, cy, r, fx, fy);
 
 	lsm_svg_view_create_radial_gradient (view, cx, cy, r, fx, fy);
diff --git a/src/lsmsvgstopelement.c b/src/lsmsvgstopelement.c
index de15419..e30bb87 100644
--- a/src/lsmsvgstopelement.c
+++ b/src/lsmsvgstopelement.c
@@ -49,7 +49,7 @@ lsm_svg_stop_element_render (LsmSvgElement *element, LsmSvgView *view)
 	else
 		offset = stop->offset.length.value_unit;
 
-	lsm_debug ("render", "[LsmSvgStopElement::render] Add stop at %g", offset);
+	lsm_debug_render ("[LsmSvgStopElement::render] Add stop at %g", offset);
 
 	lsm_svg_view_add_gradient_color_stop (view, offset);
 }
diff --git a/src/lsmsvgsvgelement.c b/src/lsmsvgsvgelement.c
index 3d5fe25..56bf168 100644
--- a/src/lsmsvgsvgelement.c
+++ b/src/lsmsvgsvgelement.c
@@ -101,7 +101,7 @@ lsm_svg_svg_element_measure (LsmSvgSvgElement *self, double *width, double *heig
 	self->svg_box.width = svg_width;
 	self->svg_box.height = svg_height;
 
-	lsm_debug ("measure", "[LsmSvgSvgElement::measure] Size = %g, %g, %g, %g",
+	lsm_debug_measure ("[LsmSvgSvgElement::measure] Size = %g, %g, %g, %g",
 		   svg_x, svg_y, svg_width, svg_height);
 
 	lsm_svg_viewbox_free (svg_viewbox);
@@ -139,7 +139,7 @@ _svg_element_render (LsmSvgElement *self, LsmSvgView *view)
 	if (viewport.width <= 0.0 || viewport.height <= 0.0)
 		return;
 
-	lsm_debug ("render", "[LsmSvgSvgElement::render] viewport %g, %g, %g, %g",
+	lsm_debug_render ("[LsmSvgSvgElement::render] viewport %g, %g, %g, %g",
 		   viewport.x, viewport.y, viewport.width, viewport.height);
 
 	lsm_svg_view_push_viewport (view, &viewport, is_viewbox_defined ? &svg->viewbox.value : NULL,
diff --git a/src/lsmsvgtspanelement.c b/src/lsmsvgtspanelement.c
index 561fd02..1ea800a 100644
--- a/src/lsmsvgtspanelement.c
+++ b/src/lsmsvgtspanelement.c
@@ -54,7 +54,7 @@ lsm_svg_tspan_element_render (LsmSvgElement *self, LsmSvgView *view)
 	GString *string = g_string_new ("");
 	double x, y;
 
-	lsm_debug ("render", "[LsmSvgTspanElement::render] Render");
+	lsm_debug_render ("[LsmSvgTspanElement::render] Render");
 
 	if (node->first_child == NULL)
 		return;
diff --git a/src/lsmsvguseelement.c b/src/lsmsvguseelement.c
index c3ddb14..6159e5e 100644
--- a/src/lsmsvguseelement.c
+++ b/src/lsmsvguseelement.c
@@ -47,7 +47,7 @@ lsm_svg_use_can_append_child (LsmDomNode *node, LsmDomNode *child)
 /* LsmSvgGraphic implementation */
 
 static LsmDomElement *
-_get_used_element (LsmSvgUseElement *use_element, const char *domain)
+_get_used_element (LsmSvgUseElement *use_element)
 {
 	LsmDomDocument *document;
 	LsmDomElement *element;
@@ -55,7 +55,7 @@ _get_used_element (LsmSvgUseElement *use_element, const char *domain)
 
 	document = lsm_dom_node_get_owner_document (LSM_DOM_NODE (use_element));
 	if (document == NULL) {
-		lsm_debug (domain, "[LsmSvgUseElement::_get_used_element] Owner document not found");
+		lsm_debug_dom ("[LsmSvgUseElement::_get_used_element] Owner document not found");
 		return NULL;
 	}
 
@@ -68,7 +68,7 @@ _get_used_element (LsmSvgUseElement *use_element, const char *domain)
 
 	element = lsm_dom_document_get_element_by_id (document, id);
 	if (!LSM_IS_SVG_ELEMENT (element)) {
-		lsm_debug (domain, "[LsmSvgUseElement::_get_used_element] Target '%s' not found", id);
+		lsm_debug_dom ("[LsmSvgUseElement::_get_used_element] Target '%s' not found", id);
 		return NULL;
 	}
 
@@ -84,11 +84,11 @@ lsm_svg_use_element_render (LsmSvgElement *self, LsmSvgView *view)
 	double x, y;
 
 	if (use_element->flags & LSM_SVG_USE_ELEMENT_FLAGS_IN_USE_FOR_RENDER) {
-		lsm_debug ("render", "[LsmSvgUseElement::render] Circular reference");
+		lsm_debug_render ("[LsmSvgUseElement::render] Circular reference");
 		return;
 	}
 
-	element = _get_used_element (use_element, "render");
+	element = _get_used_element (use_element);
 	if (element == NULL)
 		return;
 
@@ -118,7 +118,7 @@ lsm_svg_use_element_get_extents (LsmSvgElement *self, LsmSvgView *view, LsmExten
 	double x, y;
 
 	if (use_element->flags & LSM_SVG_USE_ELEMENT_FLAGS_IN_USE_FOR_GET_EXTENTS) {
-		lsm_debug ("render", "[LsmSvgUseElement::get_extents] Circular reference");
+		lsm_debug_render ("[LsmSvgUseElement::get_extents] Circular reference");
 		extents->x1 = 0;
 		extents->y1 = 0;
 		extents->x2 = 0;
@@ -126,7 +126,7 @@ lsm_svg_use_element_get_extents (LsmSvgElement *self, LsmSvgView *view, LsmExten
 		return;
 	}
 
-	element = _get_used_element (use_element, "render");
+	element = _get_used_element (use_element);
 	if (element == NULL) {
 		extents->x1 = 0;
 		extents->y1 = 0;
diff --git a/src/lsmsvgview.c b/src/lsmsvgview.c
index f86ee42..7b071d2 100644
--- a/src/lsmsvgview.c
+++ b/src/lsmsvgview.c
@@ -88,7 +88,7 @@ lsm_svg_view_normalize_length (LsmSvgView *view, const LsmSvgLength *length, Lsm
 static void
 _start_pattern (LsmSvgView *view, const LsmBox *extents, double opacity)
 {
-	lsm_debug ("render", "[LsmSvgView::start_pattern]");
+	lsm_debug_render ("[LsmSvgView::start_pattern]");
 
 	view->pattern_stack = g_slist_prepend (view->pattern_stack, view->pattern_data);
 
@@ -121,7 +121,7 @@ _end_pattern (LsmSvgView *view)
 	} else
 		view->pattern_data = NULL;
 
-	lsm_debug ("render", "[LsmSvgView::end_pattern]");
+	lsm_debug_render ("[LsmSvgView::end_pattern]");
 }
 
 static void
@@ -175,14 +175,14 @@ lsm_svg_view_add_gradient_color_stop (LsmSvgView *view, double offset)
 
 	style = view->style;
 
-	lsm_debug ("render", "[LsmSvgView::add_gradient_color_stop] opacity = %g", style->stop_opacity->value);
+	lsm_debug_render ("[LsmSvgView::add_gradient_color_stop] opacity = %g", style->stop_opacity->value);
 
 	color = &style->stop_color->value;
 
 	if (color->red < 0.0 || color->blue < 0.0 || color->green < 0.0)
 		color = &style->color->value;
 
-	lsm_debug ("render", "[LsmSvgView::add_gradient_color_stop] color = %2x%2x%2x",
+	lsm_debug_render ("[LsmSvgView::add_gradient_color_stop] color = %2x%2x%2x",
 		   (int) (255.0 * color->red),
 		   (int) (255.0 * color->green),
 		   (int) (255.0 * color->blue));
@@ -284,7 +284,7 @@ lsm_svg_view_create_surface_pattern (LsmSvgView *view,
 	x_scale = device_width / viewport->width;
 	y_scale = device_height / viewport->height;
 
-	lsm_debug ("render", "[LsmSvgView::create_pattern] pattern size = %g ,%g at %g, %g (scale %g x %g)",
+	lsm_debug_render ("[LsmSvgView::create_pattern] pattern size = %g ,%g at %g, %g (scale %g x %g)",
 		   device_width, device_height, viewport->x, viewport->y, x_scale, y_scale);
 
 	switch (surface_type) {
@@ -769,7 +769,7 @@ _paint_url (LsmSvgView *view,
 	    lsm_svg_view_circular_reference_check (view, element))
 		return;
 
-	lsm_debug ("render", "[LsmSvgView::_paint_url] Paint using '%s'", url);
+	lsm_debug_render ("[LsmSvgView::_paint_url] Paint using '%s'", url);
 
 	if (!path_infos->is_extents_defined) {
 		cairo_path_extents (view->dom_view.cairo,
@@ -785,7 +785,7 @@ _paint_url (LsmSvgView *view,
 	extents.width =  path_infos->extents.x2 - extents.x;
 	extents.height = path_infos->extents.y2 - extents.y;
 
-	lsm_debug ("render", "[LsmSvgView::_paint_url] Pattern extents x = %g, y = %g, w = %g, h = %g",
+	lsm_debug_render ("[LsmSvgView::_paint_url] Pattern extents x = %g, y = %g, w = %g, h = %g",
 		   extents.x, extents.y, extents.width, extents.height);
 
 	_start_pattern (view, &extents, opacity);
@@ -1346,7 +1346,7 @@ lsm_svg_view_show_text (LsmSvgView *view, char const *string, double x, double y
 
 	g_return_if_fail (LSM_IS_SVG_VIEW (view));
 
-	lsm_debug ("render", "[LsmSvgView::show_text] Show '%s' at %g,%g", string, x, y);
+	lsm_debug_render ("[LsmSvgView::show_text] Show '%s' at %g,%g", string, x, y);
 
 	style = view->style;
 
@@ -1357,7 +1357,7 @@ lsm_svg_view_show_text (LsmSvgView *view, char const *string, double x, double y
 		view->pango_layout_stack = g_slist_prepend (view->pango_layout_stack, view->pango_layout);
 		view->pango_layout = pango_layout_new (pango_context);
 
-		lsm_debug ("render", "[LsmSvgView::show_text] Create a new pango layout");
+		lsm_debug_render ("[LsmSvgView::show_text] Create a new pango layout");
 	} else
 		view->is_pango_layout_in_use = TRUE;
 
@@ -1456,7 +1456,7 @@ lsm_svg_view_show_text (LsmSvgView *view, char const *string, double x, double y
 	process_path (view, &path_infos);
 
 	if (pango_layout != view->pango_layout) {
-		lsm_debug ("render", "[LsmSvgView::show_text] Free the child pango layout");
+		lsm_debug_render ("[LsmSvgView::show_text] Free the child pango layout");
 
 		if (view->pango_layout != NULL) {
 			g_object_unref (view->pango_layout);
@@ -1488,7 +1488,7 @@ lsm_svg_view_push_viewbox (LsmSvgView *view, const LsmBox *viewbox)
 
 	g_return_if_fail (LSM_IS_SVG_VIEW (view));
 
-	lsm_debug ("render", "[LsmSvgView::push_viewbox] viewbox = %g, %g, %g, %g",
+	lsm_debug_render ("[LsmSvgView::push_viewbox] viewbox = %g, %g, %g, %g",
 		   viewbox->x, viewbox->y, viewbox->width, viewbox->height);
 
 	svg_viewbox = lsm_svg_viewbox_new (view->resolution_ppi, viewbox);
@@ -1502,7 +1502,7 @@ lsm_svg_view_pop_viewbox (LsmSvgView *view)
 	g_return_if_fail (LSM_IS_SVG_VIEW (view));
 	g_return_if_fail (view->viewbox_stack != NULL);
 
-	lsm_debug ("render", "[LsmSvgView::pop_viewbox]");
+	lsm_debug_render ("[LsmSvgView::pop_viewbox]");
 
 	lsm_svg_viewbox_free (view->viewbox_stack->data);
 	view->viewbox_stack = g_slist_delete_link (view->viewbox_stack, view->viewbox_stack);
@@ -1580,7 +1580,7 @@ _compute_viewbox_scale (const LsmBox *viewport, const LsmBox *viewbox,
 			*y_offset = -viewbox->y * *y_scale;
 		}
 
-		lsm_debug ("render", "[LsmSvgView::_compute_viewbox_scale] scale = %g, %g", *x_scale, *y_scale);
+		lsm_debug_render ("[LsmSvgView::_compute_viewbox_scale] scale = %g, %g", *x_scale, *y_scale);
 
 		return viewbox;
 	}
@@ -1669,7 +1669,7 @@ lsm_svg_view_push_matrix (LsmSvgView *view, const LsmSvgMatrix *matrix)
 
 	view->matrix_stack = g_slist_prepend (view->matrix_stack, ctm);
 
-	lsm_debug ("render", "[LsmSvgView::push_matrix] New transform %g, %g, %g, %g, %g, %g",
+	lsm_debug_render ("[LsmSvgView::push_matrix] New transform %g, %g, %g, %g, %g, %g",
 		   matrix->a, matrix->b, matrix->c, matrix->d, matrix->e, matrix->f);
 
 	cairo_matrix_init (&cr_matrix, matrix->a, matrix->b, matrix->c, matrix->d, matrix->e, matrix->f);
@@ -1679,7 +1679,7 @@ lsm_svg_view_push_matrix (LsmSvgView *view, const LsmSvgMatrix *matrix)
 		cairo_matrix_t current_ctm;
 		cairo_get_matrix (view->dom_view.cairo, &current_ctm);
 
-		lsm_debug ("render", "[LsmSvgView::push_matrix] Current ctm %g, %g, %g, %g, %g, %g",
+		lsm_debug_render ("[LsmSvgView::push_matrix] Current ctm %g, %g, %g, %g, %g, %g",
 			   current_ctm.xx, current_ctm.xy, current_ctm.yx, current_ctm.yy,
 			   current_ctm.x0, current_ctm.y0);
 	}
@@ -1697,7 +1697,7 @@ lsm_svg_view_pop_matrix (LsmSvgView *view)
 
 		cairo_set_matrix (view->dom_view.cairo, ctm);
 
-		lsm_debug ("render", "[LsmSvgView::pop_matrix] Restore ctm %g, %g, %g, %g, %g, %g",
+		lsm_debug_render ("[LsmSvgView::pop_matrix] Restore ctm %g, %g, %g, %g, %g, %g",
 			   ctm->xx, ctm->xy, ctm->yx, ctm->yy,
 			   ctm->x0, ctm->y0);
 
@@ -1742,7 +1742,7 @@ lsm_svg_view_push_clip (LsmSvgView *view)
 
 	url = view->style->clip_path->value;
 
-	lsm_debug ("render", "[LsmSvgView::push_clip] Using '%s'", url);
+	lsm_debug_render ("[LsmSvgView::push_clip] Using '%s'", url);
 
 	cairo_save (view->dom_view.cairo);
 
@@ -1764,7 +1764,7 @@ lsm_svg_view_push_clip (LsmSvgView *view)
 static void
 lsm_svg_view_pop_clip (LsmSvgView *view)
 {
-	lsm_debug ("render", "[LsmSvgView::pop_clip");
+	lsm_debug_render ("[LsmSvgView::pop_clip");
 
 	cairo_restore (view->dom_view.cairo);
 }
@@ -1962,7 +1962,7 @@ lsm_svg_view_circular_reference_check (LsmSvgView *view, LsmSvgElement *element)
 
 	for (iter = view->element_stack; iter != NULL; iter = iter->next)
 		if (iter->data == element) {
-			lsm_debug ("render", "[LsmSvgView::circular_reference_check] "
+			lsm_debug_render ("[LsmSvgView::circular_reference_check] "
 				   "Circular reference to %s (id = %s)",
 				   lsm_dom_element_get_tag_name (LSM_DOM_ELEMENT (element)),
 				   lsm_dom_element_get_attribute (LSM_DOM_ELEMENT (element), "id"));
@@ -1982,17 +1982,17 @@ lsm_svg_view_push_style	(LsmSvgView *view, const LsmSvgStyle *style)
 	view->style = style;
 
 	if (g_strcmp0 (style->filter->value, "none") != 0) {
-		lsm_debug ("render", "[LsmSvgView::push_style] Start filter '%s'", style->filter->value);
+		lsm_debug_render ("[LsmSvgView::push_style] Start filter '%s'", style->filter->value);
 		lsm_svg_view_push_filter (view);
 	}
 
 	if (g_strcmp0 (style->clip_path->value, "none") != 0) {
-		lsm_debug ("render", "[LsmSvgView::push_style] Start clip '%s'", style->clip_path->value);
+		lsm_debug_render ("[LsmSvgView::push_style] Start clip '%s'", style->clip_path->value);
 		lsm_svg_view_push_clip (view);
 	}
 
 	if (g_strcmp0 (style->mask->value, "none") != 0) {
-		lsm_debug ("render", "[LsmSvgView::push_style] Start mask '%s'", style->mask->value);
+		lsm_debug_render ("[LsmSvgView::push_style] Start mask '%s'", style->mask->value);
 		lsm_svg_view_push_mask (view);
 	}
 }
diff --git a/tests/lsmtest.c b/tests/lsmtest.c
index 7f78fc2..2599143 100644
--- a/tests/lsmtest.c
+++ b/tests/lsmtest.c
@@ -128,8 +128,6 @@ lasem_test_render (char const *filename)
 
 		view = lsm_dom_document_create_view (document);
 
-		lsm_dom_view_set_debug (view, lsm_debug_check ("view"));
-
 		viewport.x = 0.0;
 		viewport.y = 0.0;
 		viewport.width = 480.0;



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