[lasem] debug: add a domain argument to lsm_debug.



commit cc398727c640a528675a3eadfe855b2800837e98
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Tue Aug 3 23:43:26 2010 +0200

    debug: add a domain argument to lsm_debug.
    
    It helps to filter what we really want to see on the console.
    
    Currently, there's the following domain:
    
    dom
    update
    measure
    render

 src/lasemrender.c                 |   13 ++++-----
 src/lasemtest.c                   |   11 ++++----
 src/lsmattributes.c               |    2 +-
 src/lsmdebug.c                    |   48 ++++++++++++++++++++++++------------
 src/lsmdebug.h                    |    5 ++-
 src/lsmdomdocument.c              |    6 ++--
 src/lsmdomnode.c                  |    2 +-
 src/lsmdomparser.c                |    2 +-
 src/lsmdomview.c                  |    2 +-
 src/lsmmathmldocument.c           |    4 +-
 src/lsmmathmlelement.c            |   14 +++++-----
 src/lsmmathmlitexelement.c        |    4 +-
 src/lsmmathmloperatorelement.c    |    8 +++---
 src/lsmmathmlradicalelement.c     |    6 ++--
 src/lsmmathmlunderoverelement.c   |   16 ++++++------
 src/lsmmathmlview.c               |   24 ++++++++++--------
 src/lsmproperties.c               |    4 +-
 src/lsmsvgcircleelement.c         |    3 +-
 src/lsmsvgclippathelement.c       |    2 +-
 src/lsmsvgdocument.c              |    2 +-
 src/lsmsvgelement.c               |   10 ++++----
 src/lsmsvgimageelement.c          |    2 +-
 src/lsmsvglineargradientelement.c |    2 +-
 src/lsmsvglineelement.c           |    2 +-
 src/lsmsvgmarkerelement.c         |    8 +++---
 src/lsmsvgmaskelement.c           |    6 ++--
 src/lsmsvgpathelement.c           |    2 +-
 src/lsmsvgpatternelement.c        |    6 ++--
 src/lsmsvgradialgradientelement.c |    2 +-
 src/lsmsvgstopelement.c           |    2 +-
 src/lsmsvgsvgelement.c            |    4 +-
 src/lsmsvguseelement.c            |    6 ++--
 src/lsmsvgview.c                  |   26 ++++++++++----------
 33 files changed, 136 insertions(+), 120 deletions(-)
---
diff --git a/src/lasemrender.c b/src/lasemrender.c
index d622b7c..7bf3d9e 100644
--- a/src/lasemrender.c
+++ b/src/lasemrender.c
@@ -41,7 +41,7 @@
 
 #include <../itex2mml/itex2MML.h>
 
-static gboolean option_debug = FALSE;
+static char *option_debug_domains = NULL;
 static char *option_output_file_format = NULL;
 static char **option_input_filenames = NULL;
 static char *option_output_filename = NULL;
@@ -73,8 +73,8 @@ static const GOptionEntry entries[] =
 		&option_output_file_format, 	"Output format", NULL },
 	{ "ppi", 		'p', 0, G_OPTION_ARG_DOUBLE,
 		&option_ppi, 			"Pixel per inch", NULL },
-	{ "debug", 		'd', 0, G_OPTION_ARG_NONE,
-		&option_debug, 			"Debug mode", NULL },
+	{ "debug", 		'd', 0, G_OPTION_ARG_STRING,
+		&option_debug_domains,		"Debug domains", NULL },
 	{ NULL }
 };
 
@@ -106,8 +106,7 @@ int main(int argc, char **argv)
 
 	g_option_context_free (context);
 
-	if (option_debug)
-		lsm_debug_enable ();
+	lsm_debug_enable (option_debug_domains);
 
 	if (option_input_filenames == NULL || g_strv_length (option_input_filenames) > 1) {
 		g_print ("One input file name is required\n");
@@ -180,7 +179,7 @@ int main(int argc, char **argv)
 
 		view = lsm_dom_document_create_view (document);
 
-		lsm_dom_view_set_debug (view, option_debug);
+		lsm_dom_view_set_debug (view, lsm_debug_check ("view"));
 
 		width_pt = 2.0;
 		height_pt = 2.0;
@@ -231,7 +230,7 @@ int main(int argc, char **argv)
 
 		g_object_unref (document);
 
-		lsm_debug ("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/lasemtest.c b/src/lasemtest.c
index c74f21d..88307ff 100644
--- a/src/lasemtest.c
+++ b/src/lasemtest.c
@@ -44,7 +44,7 @@
 
 #define XML_FILENAME	"lasemtest.xml"
 
-static gboolean option_debug = FALSE;
+static char *option_debug_domains = NULL;
 static char **option_input_filenames = NULL;
 double option_ppi = 72.0;
 static gboolean fatal_warning = FALSE;
@@ -55,8 +55,8 @@ static const GOptionEntry entries[] =
 		&option_input_filenames, 	NULL, NULL},
 	{ "ppi", 		'p', 0, G_OPTION_ARG_DOUBLE,
 		&option_ppi, 			"Pixel per inch", NULL },
-	{ "debug", 		'd', 0, G_OPTION_ARG_NONE,
-		&option_debug, 			"Debug mode", NULL },
+	{ "debug", 		'd', 0, G_OPTION_ARG_STRING,
+		&option_debug_domains,		"Debug domains", NULL },
 	{ "fatal-warning", 	'f', 0, G_OPTION_ARG_NONE,
 		&fatal_warning,			"Make warning fatal", NULL },
 	{ NULL }
@@ -131,7 +131,7 @@ lasem_test_render (char const *filename)
 
 		view = lsm_dom_document_create_view (document);
 
-		lsm_dom_view_set_debug (view, option_debug);
+		lsm_dom_view_set_debug (view, lsm_debug_check ("view"));
 
 		viewport.x = 0.0;
 		viewport.y = 0.0;
@@ -321,8 +321,7 @@ main (int argc, char **argv)
 
 	g_option_context_free (context);
 
-	if (option_debug)
-		lsm_debug_enable ();
+	lsm_debug_enable (option_debug_domains);
 
 	if (fatal_warning)
 		g_log_set_fatal_mask ("Lasem", G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
diff --git a/src/lsmattributes.c b/src/lsmattributes.c
index 4b2b15c..a2e91d7 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 ("[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 6175ea7..dc83de0 100644
--- a/src/lsmdebug.c
+++ b/src/lsmdebug.c
@@ -2,32 +2,49 @@
 #include <glib/gprintf.h>
 #include <stdlib.h>
 
-static gboolean debug_checked = FALSE;
-static gboolean debug_enabled = FALSE;
+static GHashTable *lsm_debug_domains = NULL;
 
-static gboolean
-_is_debug_enabled ()
+static void
+lsm_debug_initialize (const char *debug_var)
 {
-	const char *debug_var;
+	if (lsm_debug_domains != NULL)
+		return;
+
+	lsm_debug_domains = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 
-	if (debug_checked)
-		return debug_enabled;
+	if (debug_var != NULL) {
+		char **domains;
+		int i;
 
-	debug_var = g_getenv ("LSM_DEBUG");
+		domains = g_strsplit (debug_var, ":", -1);
+		for (i = 0; domains[i] != NULL; i++) {
+			char *debug_domain;
 
-	debug_enabled = debug_var != NULL ? atoi (debug_var) != 0 : FALSE;
+			debug_domain = g_strdup (domains[i]);
+			g_hash_table_insert (lsm_debug_domains, debug_domain, debug_domain);
+		}
+		g_strfreev (domains);
+	}
+}
+
+gboolean
+lsm_debug_check (const char *domain)
+{
+	if (domain == NULL)
+		return FALSE;
 
-	debug_checked = TRUE;
+	if (lsm_debug_domains == NULL)
+		lsm_debug_initialize (g_getenv ("LSM_DEBUG"));
 
-	return debug_enabled;
+	return g_hash_table_lookup (lsm_debug_domains, domain) != NULL;
 }
 
 void
-lsm_debug (char const *format, ...)
+lsm_debug (const char *domain, char const *format, ...)
 {
 	va_list args;
 
-	if (!_is_debug_enabled())
+	if (!lsm_debug_check (domain))
 		return;
 
 	va_start (args, format);
@@ -37,8 +54,7 @@ lsm_debug (char const *format, ...)
 }
 
 void
-lsm_debug_enable (void)
+lsm_debug_enable (const char *domains)
 {
-	debug_enabled = TRUE;
-	debug_checked = TRUE;
+	lsm_debug_initialize (domains);
 }
diff --git a/src/lsmdebug.h b/src/lsmdebug.h
index cb197de..9418dce 100644
--- a/src/lsmdebug.h
+++ b/src/lsmdebug.h
@@ -5,8 +5,9 @@
 
 G_BEGIN_DECLS
 
-void lsm_debug 		(char const *format, ...);
-void lsm_debug_enable 	(void);
+void 		lsm_debug 			(const char *domain, char const *format, ...);
+gboolean 	lsm_debug_check 		(const char *domain);
+void 		lsm_debug_enable 		(const char *domains);
 
 G_END_DECLS
 
diff --git a/src/lsmdomdocument.c b/src/lsmdomdocument.c
index c373dc3..1db7164 100644
--- a/src/lsmdomdocument.c
+++ b/src/lsmdomdocument.c
@@ -161,7 +161,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 ("[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);
 }
@@ -175,7 +175,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 ("[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);
@@ -184,7 +184,7 @@ lsm_dom_document_register_element (LsmDomDocument *self, LsmDomElement *element,
 	if (id != NULL) {
 		char *new_id = g_strdup (id);
 
-		lsm_debug ("[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/lsmdomnode.c b/src/lsmdomnode.c
index 0a304a0..8d281f1 100644
--- a/src/lsmdomnode.c
+++ b/src/lsmdomnode.c
@@ -212,7 +212,7 @@ lsm_dom_node_append_child (LsmDomNode* self, LsmDomNode* new_child)
 	g_return_val_if_fail (new_child->parent_node == NULL, NULL);
 
 	if (!LSM_DOM_NODE_GET_CLASS (self)->can_append_child (self, new_child)) {
-		lsm_debug ("[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));
 		return NULL;
diff --git a/src/lsmdomparser.c b/src/lsmdomparser.c
index 619e844..d147bf1 100644
--- a/src/lsmdomparser.c
+++ b/src/lsmdomparser.c
@@ -297,7 +297,7 @@ lsm_dom_document_new_from_memory (const char *buffer, int size, GError **error)
 			g_object_unref (state.document);
 		state.document = NULL;
 
-		lsm_debug ("[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 f2b20b2..e8db2ea 100644
--- a/src/lsmdomview.c
+++ b/src/lsmdomview.c
@@ -92,7 +92,7 @@ lsm_dom_view_render (LsmDomView *view, double x, double y)
 
 	cairo_restore (view->cairo);
 
-	lsm_debug ("[LsmDomView::render] cairo status = %s",
+	lsm_debug ("render", "[LsmDomView::render] cairo status = %s",
 		   cairo_status_to_string (cairo_status (view->cairo)));
 }
 
diff --git a/src/lsmmathmldocument.c b/src/lsmmathmldocument.c
index 2bf7446..9e36b6b 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 ("[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 ("[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 b584a2f..0b2eb2d 100644
--- a/src/lsmmathmlelement.c
+++ b/src/lsmmathmlelement.c
@@ -109,7 +109,7 @@ 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 ("[Element::update] %s already up to date",
+		lsm_debug ("update", "[Element::update] %s already up to date",
 			    lsm_dom_node_get_node_name (LSM_DOM_NODE (self)));
 		return FALSE;
 	}
@@ -122,7 +122,7 @@ lsm_mathml_element_update (LsmMathmlElement *self, const LsmMathmlStyle *parent_
 	if (element_class->update != NULL)
 		element_class->update (self, style);
 
-	lsm_debug ("[Element::update] update %s (%s-%g)",
+	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);
@@ -196,7 +196,7 @@ _measure (LsmMathmlElement *self, LsmMathmlView *view, const LsmMathmlBbox *bbox
 	}
 
 	if (stretchy_found) {
-		lsm_debug ("[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) {
@@ -233,12 +233,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 ("[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 ("[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;
@@ -247,7 +247,7 @@ lsm_mathml_element_measure (LsmMathmlElement *element, LsmMathmlView *view, cons
 		element->need_measure = FALSE;
 		element->need_layout = TRUE;
 	} else
-		lsm_debug ("[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;
@@ -291,7 +291,7 @@ lsm_mathml_element_layout (LsmMathmlElement *self, LsmMathmlView *view,
 
 	g_return_if_fail (element_class != NULL);
 
-	lsm_debug ("[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 6c3a85b..b4f5f55 100644
--- a/src/lsmmathmlitexelement.c
+++ b/src/lsmmathmlitexelement.c
@@ -59,7 +59,7 @@ _update (LsmMathmlElement *self, LsmMathmlStyle *style)
 
 	need_conversion = g_strcmp0 (itex_element->itex, string->str) != 0;
 
-	lsm_debug ("[MathmlItex::update] itex = '%s'", itex_element->itex);
+	lsm_debug ("update", "[MathmlItex::update] itex = '%s'", itex_element->itex);
 
 	if (need_conversion) {
 		LsmMathmlDocument *document;
@@ -67,7 +67,7 @@ _update (LsmMathmlElement *self, LsmMathmlStyle *style)
 		g_free (itex_element->itex);
 		itex_element->itex = string->str;
 
-		lsm_debug ("[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 dc5163c..b85d436 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 ("[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 ("[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 ("[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 ("[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 996a9a1..58e4a53 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 ("[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 ("[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 ("[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 a843e02..541c962 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 ("[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 ("[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 ("[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 ("[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 ("[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 ("[UnderOver::measure] All stretchy");
+			lsm_debug ("measure", "[UnderOver::measure] All stretchy");
 			regular_stretch_bbox = operator_stretch_bbox;
 		}
 
-		lsm_debug ("[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 ("[UnderOver::measure] End");
+	lsm_debug ("measure", "[UnderOver::measure] End");
 
 	return &self->bbox;
 }
diff --git a/src/lsmmathmlview.c b/src/lsmmathmlview.c
index 1b31ef6..57b8a81 100644
--- a/src/lsmmathmlview.c
+++ b/src/lsmmathmlview.c
@@ -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 ("[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 ("[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));
 
@@ -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 ("[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 ("[LsmMathmlView::measure_operator] operator = %s", text);
+		lsm_debug ("render", "[LsmMathmlView::measure_operator] operator = %s", text);
 
 	} else {
 		PangoLayoutIter *iter;
@@ -390,7 +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 ("[LsmMathmlView::measure_operator] Glyph #%i -> width = %g, height = %g", i,
+			lsm_debug ("render",
+				   "[LsmMathmlView::measure_operator] Glyph #%i -> width = %g, height = %g", i,
 				    width, height);
 
 			if (!is_stretch_bbox_defined) {
@@ -413,7 +414,7 @@ lsm_mathml_view_measure_operator (LsmMathmlView *view,
 		}
 
 		if (found)
-			lsm_debug ("[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);
@@ -483,7 +484,7 @@ lsm_mathml_view_show_operator (LsmMathmlView *view,
 	pango_layout = view->dom_view.measure_pango_layout;
 
 	if (stretch_bbox->is_defined)
-		lsm_debug ("[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);
@@ -514,7 +515,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 ("[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));
 
@@ -540,14 +541,14 @@ lsm_mathml_view_show_operator (LsmMathmlView *view,
 		}
 
 		if (found)
-			lsm_debug ("[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 ("[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));
@@ -989,7 +990,8 @@ lsm_mathml_view_render (LsmDomView *dom_view)
 
 	lsm_mathml_math_element_render (math_element, view);
 
-	lsm_debug ("[LsmMathmlView::render] cairo status = %s", cairo_status_to_string (cairo_status (cairo)));
+	lsm_debug ("render", "[LsmMathmlView::render] cairo status = %s",
+		   cairo_status_to_string (cairo_status (cairo)));
 }
 
 LsmMathmlView *
diff --git a/src/lsmproperties.c b/src/lsmproperties.c
index 934d48a..38da0bf 100644
--- a/src/lsmproperties.c
+++ b/src/lsmproperties.c
@@ -109,7 +109,7 @@ _set_property (LsmPropertyManager *manager,
 
 		success = trait_class->from_string (PROPERTY_TRAIT (property), (char *) value);
 		if (!success) {
-			lsm_debug ("[LsmPropertyManager::set_property] Invalid property value %s='%s'",
+			lsm_debug ("dom", "[LsmPropertyManager::set_property] Invalid property value %s='%s'",
 				   name, value);
 			property_free (property, property_infos->trait_class);
 
@@ -176,7 +176,7 @@ lsm_property_manager_set_property (LsmPropertyManager *manager,
 					old_char = *end_ptr;
 					*end_ptr = '\0';
 
-					lsm_debug ("[LsmPropertyManager::set_property] inline_style %s = %s",
+					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 777239a..5358106 100644
--- a/src/lsmsvgcircleelement.c
+++ b/src/lsmsvgcircleelement.c
@@ -48,8 +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 ("[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 0abd807..70ac631 100644
--- a/src/lsmsvgclippathelement.c
+++ b/src/lsmsvgclippathelement.c
@@ -45,7 +45,7 @@ lsm_svg_clip_path_element_render (LsmSvgElement *self, LsmSvgView *view)
 	LsmSvgStyle *style;
 
 	if (!clip->enable_rendering) {
-		lsm_debug ("[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 7985080..9a0747c 100644
--- a/src/lsmsvgdocument.c
+++ b/src/lsmsvgdocument.c
@@ -128,7 +128,7 @@ lsm_svg_document_create_element (LsmDomDocument *document, const char *tag_name)
 		node = lsm_svg_clip_path_element_new ();
 
 	if (node != NULL)
-		lsm_debug ("[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 2b4532d..bee1c9d 100644
--- a/src/lsmsvgelement.c
+++ b/src/lsmsvgelement.c
@@ -57,7 +57,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 ("[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 */
@@ -97,7 +97,7 @@ _render (LsmSvgElement *element, LsmSvgView *view)
 {
 	LsmDomNode *node;
 
-	lsm_debug ("[LsmSvgElement::_render");
+	lsm_debug ("render", "[LsmSvgElement::_render");
 
 	lsm_svg_view_push_group_opacity (view);
 
@@ -128,7 +128,7 @@ lsm_svg_element_render (LsmSvgElement *element, LsmSvgView *view)
 
 	element_class = LSM_SVG_ELEMENT_GET_CLASS (element);
 	if (element_class->render != NULL) {
-		lsm_debug ("[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");
 
@@ -177,7 +177,7 @@ _get_extents (LsmSvgElement *self, LsmSvgView *view, LsmExtents *extents)
 	gboolean first_child = TRUE;
 	LsmExtents element_extents = {0.0, 0.0, 0.0, 0.0};
 
-	lsm_debug ("[LsmSvgGraphic::_graphic_get_extents]");
+	lsm_debug ("render", "[LsmSvgGraphic::_graphic_get_extents]");
 
 	for (node = LSM_DOM_NODE (self)->first_child; node != NULL; node = node->next_sibling) {
 		if (LSM_IS_SVG_ELEMENT (node)) {
@@ -217,7 +217,7 @@ lsm_svg_element_get_extents (LsmSvgElement *element, LsmSvgView *view, LsmExtent
 	if (element_class->get_extents != NULL) {
 		element_class->get_extents (element, view, extents);
 
-		lsm_debug ("LsmSvgElement::get_extents] Exents for '%s' = %g,%g %g,%g",
+		lsm_debug ("measure", "LsmSvgElement::get_extents] Exents 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/lsmsvgimageelement.c b/src/lsmsvgimageelement.c
index 9500364..15a7003 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 ("[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 2b6192c..d38bcc3 100644
--- a/src/lsmsvglineargradientelement.c
+++ b/src/lsmsvglineargradientelement.c
@@ -58,7 +58,7 @@ lsm_svg_linear_gradient_element_create_gradient (LsmSvgElement *self, LsmSvgView
 	x2 = lsm_svg_view_normalize_length (view, &linear->x2.length, LSM_SVG_LENGTH_DIRECTION_HORIZONTAL);
 	y2 = lsm_svg_view_normalize_length (view, &linear->y2.length, LSM_SVG_LENGTH_DIRECTION_VERTICAL);
 
-	lsm_debug ("[LsmSvgLinearGradientElement::render] Create linear %g, %g, %g, %g",
+	lsm_debug ("render", "[LsmSvgLinearGradientElement::render] Create linear %g, %g, %g, %g",
 		    x1, y1, x2, y2);
 
 	if (is_object_bounding_box)
diff --git a/src/lsmsvglineelement.c b/src/lsmsvglineelement.c
index 7561b6e..663da64 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 ("[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 2281ecb..4e40e8a 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 ("[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 ("[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 ("[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 ("[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 7c5d3dc..c8f509b 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 ("[LsmSvgMaskElement::render] Direct rendering not allowed");
+		lsm_debug ("render", "[LsmSvgMaskElement::render] Direct rendering not allowed");
 		return;
 	} else {
 		mask->enable_rendering = FALSE;
@@ -87,7 +87,7 @@ lsm_svg_mask_element_render (LsmSvgElement *self, LsmSvgView *view)
 	if (viewport.width <= 0.0 || viewport.height <= 0.0)
 		return;
 
-	lsm_debug ("[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);
 
 	lsm_svg_view_create_surface_pattern (view, &viewport,
@@ -106,7 +106,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 ("[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 eaaa26d..d82679f 100644
--- a/src/lsmsvgpathelement.c
+++ b/src/lsmsvgpathelement.c
@@ -43,7 +43,7 @@ lsm_svg_path_element_render (LsmSvgElement *self, LsmSvgView *view)
 
 	path = LSM_SVG_PATH_ELEMENT (self);
 
-	lsm_debug ("[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 66cb21a..6a123a5 100644
--- a/src/lsmsvgpatternelement.c
+++ b/src/lsmsvgpatternelement.c
@@ -49,7 +49,7 @@ lsm_svg_pattern_element_render (LsmSvgElement *self, LsmSvgView *view)
 	LsmSvgStyle *style;
 
 	if (!pattern->enable_rendering) {
-		lsm_debug ("[LsmSvgPatternElement::render] Direct rendering not allowed");
+		lsm_debug ("render", "[LsmSvgPatternElement::render] Direct rendering not allowed");
 		return;
 	} else {
 		pattern->enable_rendering = FALSE;
@@ -91,7 +91,7 @@ lsm_svg_pattern_element_render (LsmSvgElement *self, LsmSvgView *view)
 	if (viewport.width <= 0.0 || viewport.height <= 0.0)
 		return;
 
-	lsm_debug ("[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);
 
 	lsm_svg_view_create_surface_pattern (view, &image_box,
@@ -111,7 +111,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 ("[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 7c7af85..387104f 100644
--- a/src/lsmsvgradialgradientelement.c
+++ b/src/lsmsvgradialgradientelement.c
@@ -83,7 +83,7 @@ lsm_svg_radial_gradient_element_create_gradient (LsmSvgElement *self, LsmSvgView
 	if (is_object_bounding_box)
 		lsm_svg_view_pop_viewbox (view);
 
-	lsm_debug ("[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 5911def..0291324 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 ("[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 c4aa82d..4fff145 100644
--- a/src/lsmsvgsvgelement.c
+++ b/src/lsmsvgsvgelement.c
@@ -98,7 +98,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 ("[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);
@@ -124,7 +124,7 @@ _svg_element_render (LsmSvgElement *self, LsmSvgView *view)
 				   svg->viewbox.value.height <= 0.0))
 		return;
 
-	lsm_debug ("[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/lsmsvguseelement.c b/src/lsmsvguseelement.c
index 4e5f6d4..dceab73 100644
--- a/src/lsmsvguseelement.c
+++ b/src/lsmsvguseelement.c
@@ -58,7 +58,7 @@ lsm_svg_use_element_render (LsmSvgElement *self, LsmSvgView *view)
 
 	document = lsm_dom_node_get_owner_document (LSM_DOM_NODE (self));
 	if (document == NULL) {
-		lsm_debug ("[LsmSvgUseElement::render] Owner document not found");
+		lsm_debug ("render", "[LsmSvgUseElement::render] Owner document not found");
 		return;
 	}
 
@@ -73,7 +73,7 @@ lsm_svg_use_element_render (LsmSvgElement *self, LsmSvgView *view)
 
 	element = lsm_dom_document_get_element_by_id (document, id);
 	if (!LSM_IS_SVG_ELEMENT (element)) {
-		lsm_debug ("[LsmSvgUseElement::render] Target '%s' not found", id);
+		lsm_debug ("render", "[LsmSvgUseElement::render] Target '%s' not found", id);
 		return;
 	}
 
@@ -82,7 +82,7 @@ lsm_svg_use_element_render (LsmSvgElement *self, LsmSvgView *view)
 	height = lsm_svg_view_normalize_length (view, &use_element->height.length,
 						LSM_SVG_LENGTH_DIRECTION_VERTICAL);
 
-	lsm_debug ("[LsmSvgUseElement::render] Use '%s'", id);
+	lsm_debug ("render", "[LsmSvgUseElement::render] Use '%s'", id);
 
 	x = lsm_svg_view_normalize_length (view, &use_element->x.length,
 					   LSM_SVG_LENGTH_DIRECTION_HORIZONTAL);
diff --git a/src/lsmsvgview.c b/src/lsmsvgview.c
index 5ea7ef8..2e2753c 100644
--- a/src/lsmsvgview.c
+++ b/src/lsmsvgview.c
@@ -72,7 +72,7 @@ lsm_svg_view_normalize_length (LsmSvgView *view, const LsmSvgLength *length, Lsm
 static void
 _start_pattern (LsmSvgView *view, const LsmBox *extents)
 {
-	lsm_debug ("[LsmSvgView::start_pattern]");
+	lsm_debug ("render", "[LsmSvgView::start_pattern]");
 
 	view->pattern_stack = g_slist_prepend (view->pattern_stack, view->pattern_data);
 
@@ -109,7 +109,7 @@ _end_pattern (LsmSvgView *view)
 	} else
 		view->pattern_data = NULL;
 
-	lsm_debug ("[LsmSvgView::end_pattern]");
+	lsm_debug ("render", "[LsmSvgView::end_pattern]");
 }
 
 static void
@@ -163,7 +163,7 @@ lsm_svg_view_add_gradient_color_stop (LsmSvgView *view, double offset)
 
 	style = view->style;
 
-	lsm_debug ("[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;
 
@@ -221,7 +221,7 @@ lsm_svg_view_create_surface_pattern (LsmSvgView *view,
 	width = viewport->width;
 	height = viewport->height;
 
-	lsm_debug ("[LsmSvgView::create_pattern] pattern size = %g ,%g at %g, %g",
+	lsm_debug ("render", "[LsmSvgView::create_pattern] pattern size = %g ,%g at %g, %g",
 		   width, height, x, y);
 
 	if (height < 1 || width < 1)
@@ -1256,7 +1256,7 @@ lsm_svg_view_push_viewbox (LsmSvgView *view, const LsmBox *viewbox)
 
 	g_return_if_fail (LSM_IS_SVG_VIEW (view));
 
-	lsm_debug ("[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);
@@ -1270,7 +1270,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 ("[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);
@@ -1348,7 +1348,7 @@ _compute_viewbox_scale (const LsmBox *viewport, const LsmBox *viewbox,
 			*y_offset = -viewbox->y * *y_scale;
 		}
 
-		lsm_debug ("[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;
 	}
@@ -1437,7 +1437,7 @@ lsm_svg_view_push_matrix (LsmSvgView *view, const LsmSvgMatrix *matrix)
 
 	view->matrix_stack = g_slist_prepend (view->matrix_stack, ctm);
 
-	lsm_debug ("[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);
@@ -1447,7 +1447,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 ("[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);
 	}
@@ -1506,7 +1506,7 @@ lsm_svg_view_push_clip (LsmSvgView *view)
 
 	url = view->style->clip_path->value;
 
-	lsm_debug ("[LsmSvgView::push_clip] Using '%s'", url);
+	lsm_debug ("render", "[LsmSvgView::push_clip] Using '%s'", url);
 
 	cairo_save (view->dom_view.cairo);
 
@@ -1527,7 +1527,7 @@ lsm_svg_view_push_clip (LsmSvgView *view)
 static void
 lsm_svg_view_pop_clip (LsmSvgView *view)
 {
-	lsm_debug ("[LsmSvgView::pop_clip");
+	lsm_debug ("render", "[LsmSvgView::pop_clip");
 
 	cairo_restore (view->dom_view.cairo);
 }
@@ -1637,12 +1637,12 @@ lsm_svg_view_push_style	(LsmSvgView *view, const LsmSvgStyle *style)
 	view->style = style;
 
 	if (g_strcmp0 (style->clip_path->value, "none") != 0) {
-		lsm_debug ("[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 ("[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);
 	}
 }



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