[aravis] debug: allow debug level selection for each category.



commit 1bec5fae48f53f23d7c6aa2534013751c0699d29
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Mon May 9 16:55:48 2011 +0200

    debug: allow debug level selection for each category.

 docs/reference/aravis/aravis-overview.xml |   22 ++--
 docs/reference/aravis/aravis-sections.txt |   40 +++++++
 src/arvdebug.c                            |  176 +++++++++++++++++++++++++----
 src/arvdebug.h                            |   71 +++++++++++-
 src/arvevaluator.c                        |   47 ++++----
 src/arvfakecamera.c                       |    7 +-
 src/arvfakegvcamera.c                     |   41 ++++----
 src/arvfakestream.c                       |    4 +-
 src/arvgc.c                               |   22 ++--
 src/arvgccommand.c                        |    6 +-
 src/arvgcconverter.c                      |   10 +-
 src/arvgcenumeration.c                    |   12 +-
 src/arvgcnode.c                           |    4 +-
 src/arvgcregister.c                       |   25 ++--
 src/arvgcswissknife.c                     |    5 +-
 src/arvgvcp.c                             |   18 +++-
 src/arvgvcp.h                             |    3 +-
 src/arvgvdevice.c                         |   49 ++++-----
 src/arvgvinterface.c                      |   16 ++--
 src/arvgvsp.c                             |   18 +++-
 src/arvgvsp.h                             |    4 +-
 src/arvgvstream.c                         |  118 ++++++++++----------
 src/arvstream.c                           |   10 +-
 src/arvsystem.c                           |    2 +
 src/arvtools.c                            |   20 ++--
 src/arvzip.c                              |    2 +-
 26 files changed, 497 insertions(+), 255 deletions(-)
---
diff --git a/docs/reference/aravis/aravis-overview.xml b/docs/reference/aravis/aravis-overview.xml
index 4cdcb89..667b45e 100644
--- a/docs/reference/aravis/aravis-overview.xml
+++ b/docs/reference/aravis/aravis-overview.xml
@@ -71,32 +71,28 @@
 	</para>
 
 	<para>
-		The ARV_DEBUG environment variable can be set to a colon
-		separated list of debugging domains, which will make Aravis
+		The ARV_DEBUG environment variable can be set to a comma
+		separated list of debugging categories, which will make Aravis
 		print out different types of debugging informations to the
-		console. For example, the following command before running an
-		Aravis based application will make Aravis print out stream
-		related informations:
+		console. A debug level can also be specified, using a number from 0 (none) to
+		3 (log) separated from the category name by a colon. For example, the
+		following command before running an Aravis based application will make
+		Aravis print out all stream and device related informations:
 		<literallayout>
-			<userinput>export ARV_DEBUG=stream</userinput>
+			<userinput>export ARV_DEBUG=stream:3,device:3</userinput>
 		</literallayout>
-		Available domains are:
+		Available categories are:
 		<itemizedlist>
 			<listitem>all</listitem>
 			<listitem>interface</listitem>
-			<listitem>camera</listitem>
 			<listitem>device</listitem>
 			<listitem>stream</listitem>
 			<listitem>stream-thread</listitem>
 			<listitem>gvcp</listitem>
 			<listitem>gvsp</listitem>
 			<listitem>genicam</listitem>
-			<listitem>parser</listitem>
 			<listitem>evaluator</listitem>
-			<listitem>fake</listitem>
-			<listitem>gst</listitem>
-			<listitem>decompress</listitem>
-			<listitem>zip</listitem>
+			<listitem>misc</listitem>
 		</itemizedlist>
 	</para>
 
diff --git a/docs/reference/aravis/aravis-sections.txt b/docs/reference/aravis/aravis-sections.txt
index 89e7f0e..0bdaceb 100644
--- a/docs/reference/aravis/aravis-sections.txt
+++ b/docs/reference/aravis/aravis-sections.txt
@@ -895,8 +895,48 @@ sizeof
 arv_debug
 arv_debug_check
 arv_debug_enable
+arv_debug_shutdown
 <SUBSECTION Private>
 ArvDebugLevel
+ArvDebugCategory
+arv_debug_category_device
+arv_debug_category_evaluator
+arv_debug_category_genicam
+arv_debug_category_gvcp
+arv_debug_category_gvsp
+arv_debug_category_interface
+arv_debug_category_misc
+arv_debug_category_stream
+arv_debug_category_stream_thread
+arv_debug_device
+arv_debug_evaluator
+arv_debug_genicam
+arv_debug_gvcp
+arv_debug_gvsp
+arv_debug_interface
+arv_debug_misc
+arv_debug_stream
+arv_debug_stream_thread
+arv_log
+arv_log_device
+arv_log_evaluator
+arv_log_genicam
+arv_log_gvcp
+arv_log_gvsp
+arv_log_interface
+arv_log_misc
+arv_log_stream
+arv_log_stream_thread
+arv_warning
+arv_warning_device
+arv_warning_evaluator
+arv_warning_genicam
+arv_warning_gvcp
+arv_warning_gvsp
+arv_warning_interface
+arv_warning_misc
+arv_warning_stream
+arv_warning_stream_thread
 </SECTION>
 
 <SECTION>
diff --git a/src/arvdebug.c b/src/arvdebug.c
index 4c2f690..6ecb464 100644
--- a/src/arvdebug.c
+++ b/src/arvdebug.c
@@ -29,62 +29,190 @@
 #include <glib/gprintf.h>
 #include <stdlib.h>
 
-static GHashTable *arv_debug_domains = NULL;
+ArvDebugCategory arv_debug_category_interface =
+{
+	.name = "interface",
+	.level = -1
+};
+
+ArvDebugCategory arv_debug_category_device =
+{
+	.name = "device",
+	.level = -1
+};
+
+ArvDebugCategory arv_debug_category_stream =
+{
+	.name = "stream",
+	.level = -1
+};
+
+ArvDebugCategory arv_debug_category_stream_thread =
+{
+	.name = "stream-thread",
+	.level = -1
+};
+
+ArvDebugCategory arv_debug_category_gvcp =
+{
+	.name = "gvcp",
+	.level = -1
+};
+
+ArvDebugCategory arv_debug_category_gvsp =
+{
+	.name = "gvsp",
+	.level = -1
+};
+
+ArvDebugCategory arv_debug_category_genicam =
+{
+	.name = "genicam",
+	.level = -1
+};
+
+ArvDebugCategory arv_debug_category_evaluator =
+{
+	.name = "evaluator",
+	.level = -1
+};
+
+ArvDebugCategory arv_debug_category_misc =
+{
+	.name = "misc",
+	.level = -1
+};
+
+static GHashTable *arv_debug_categories = NULL;
+
+static void
+arv_debug_category_free (ArvDebugCategory *category)
+{
+	if (category != NULL) {
+		g_free (category->name);
+		g_free (category);
+	}
+}
 
 static void
 arv_debug_initialize (const char *debug_var)
 {
-	if (arv_debug_domains != NULL)
+	if (arv_debug_categories != NULL)
 		return;
 
-	arv_debug_domains = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+	arv_debug_categories = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
+						      (GDestroyNotify) arv_debug_category_free);
 
 	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++) {
+			ArvDebugCategory *category;
+			char **infos;
+
+			category = g_new0 (ArvDebugCategory, 1);
+
+			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 = ARV_DEBUG_LEVEL_DEBUG;
 
-			debug_domain = g_strdup (domains[i]);
-			g_hash_table_insert (arv_debug_domains, debug_domain, debug_domain);
+				g_hash_table_insert (arv_debug_categories, category->name, category);
+			} else
+				g_free (category);
+
+			g_strfreev (infos);
 		}
-		g_strfreev (domains);
+		g_strfreev (categories);
 	}
 }
 
 gboolean
-arv_debug_check (const char *domain)
+arv_debug_check	(ArvDebugCategory *category, ArvDebugLevel level)
 {
-	if (domain == NULL)
-		return FALSE;
+	ArvDebugCategory *configured_category;
 
-	if (arv_debug_domains == NULL)
-		arv_debug_initialize (g_getenv ("ARV_DEBUG"));
+	if (category == NULL)
+		return FALSE;
 
-	if (g_hash_table_lookup (arv_debug_domains, domain) != NULL)
+	if ((int) level <= (int) category->level)
 		return TRUE;
 
-	return g_hash_table_lookup (arv_debug_domains, "all") != NULL;
+	if ((int) category->level >= 0)
+		return FALSE;
+
+	arv_debug_initialize (g_getenv ("ARV_DEBUG"));
+
+	configured_category = g_hash_table_lookup (arv_debug_categories, category->name);
+	if (configured_category == NULL)
+		configured_category = g_hash_table_lookup (arv_debug_categories, "all");
+	if (configured_category != NULL)
+		category->level = configured_category->level;
+	else
+		category->level = 0;
+
+
+	return (int) level <= (int) category->level;
+}
+
+static void
+arv_debug_with_level (ArvDebugCategory *category, ArvDebugLevel level, const char *format, va_list args)
+{
+	if (!arv_debug_check (category, level))
+		return;
+
+	g_vprintf (format, args);
+	g_printf ("\n");
 }
 
 void
-arv_debug (const char *domain, char const *format, ...)
+arv_warning (ArvDebugCategory *category, const char *format, ...)
 {
 	va_list args;
 
-	if (!arv_debug_check (domain))
-		return;
+	va_start (args, format);
+	arv_debug_with_level (category, ARV_DEBUG_LEVEL_WARNING, format, args);
+	va_end (args);
+}
+
+void
+arv_debug (ArvDebugCategory *category, const char *format, ...)
+{
+	va_list args;
 
 	va_start (args, format);
-	g_vprintf (format, args);
-	g_printf ("\n");
+	arv_debug_with_level (category, ARV_DEBUG_LEVEL_DEBUG, format, args);
+	va_end (args);
+}
+
+void
+arv_log (ArvDebugCategory *category, const char *format, ...)
+{
+	va_list args;
+
+	va_start (args, format);
+	arv_debug_with_level (category, ARV_DEBUG_LEVEL_LOG, format, args);
 	va_end (args);
 }
 
 void
-arv_debug_enable (const char *domains)
+arv_debug_enable (const char *categories)
+{
+	arv_debug_initialize (categories);
+}
+
+void
+arv_debug_shutdown (void)
 {
-	arv_debug_initialize (domains);
+	GHashTable *debug_categories = arv_debug_categories;
+
+	arv_debug_categories = NULL;
+
+	if (debug_categories != NULL)
+		g_hash_table_unref (debug_categories);
 }
diff --git a/src/arvdebug.h b/src/arvdebug.h
index e9f1a18..cb729d0 100644
--- a/src/arvdebug.h
+++ b/src/arvdebug.h
@@ -1,6 +1,6 @@
 /* Aravis - Digital camera library
  *
- * Copyright © 2009-2010 Emmanuel Pacaud
+ * Copyright © 2009-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
@@ -27,9 +27,72 @@
 
 G_BEGIN_DECLS
 
-void 		arv_debug 			(const char *domain, char const *format, ...);
-gboolean 	arv_debug_check 		(const char *domain);
-void 		arv_debug_enable 		(const char *domains);
+typedef enum {
+	ARV_DEBUG_LEVEL_NONE,
+	ARV_DEBUG_LEVEL_WARNING,
+	ARV_DEBUG_LEVEL_DEBUG,
+	ARV_DEBUG_LEVEL_LOG,
+	ARV_DEBUG_LEVEL_COUNT
+} ArvDebugLevel;
+
+typedef struct {
+	char *name;
+	ArvDebugLevel level;
+} ArvDebugCategory;
+
+extern ArvDebugCategory arv_debug_category_interface;
+extern ArvDebugCategory arv_debug_category_device;
+extern ArvDebugCategory arv_debug_category_stream;
+extern ArvDebugCategory arv_debug_category_stream_thread;
+extern ArvDebugCategory arv_debug_category_gvcp;
+extern ArvDebugCategory arv_debug_category_gvsp;
+extern ArvDebugCategory arv_debug_category_genicam;
+extern ArvDebugCategory arv_debug_category_evaluator;
+extern ArvDebugCategory arv_debug_category_misc;
+
+#define arv_debug_interface(...) 	arv_debug (&arv_debug_category_interface, __VA_ARGS__)
+#define arv_log_interface(...)		arv_log (&arv_debug_category_interface, __VA_ARGS__)
+#define arv_warning_interface(...)	arv_warning (&arv_debug_category_interface, __VA_ARGS__)
+
+#define arv_debug_device(...) 		arv_debug (&arv_debug_category_device, __VA_ARGS__)
+#define arv_log_device(...)		arv_log (&arv_debug_category_device, __VA_ARGS__)
+#define arv_warning_device(...)		arv_warning (&arv_debug_category_device, __VA_ARGS__)
+
+#define arv_debug_stream(...) 		arv_debug (&arv_debug_category_stream, __VA_ARGS__)
+#define arv_log_stream(...)		arv_log (&arv_debug_category_stream, __VA_ARGS__)
+#define arv_warning_stream(...)		arv_warning (&arv_debug_category_stream, __VA_ARGS__)
+
+#define arv_debug_stream_thread(...) 	arv_debug (&arv_debug_category_stream_thread, __VA_ARGS__)
+#define arv_log_stream_thread(...)	arv_log (&arv_debug_category_stream_thread, __VA_ARGS__)
+#define arv_warning_stream_thread(...)	arv_warning (&arv_debug_category_stream_thread, __VA_ARGS__)
+
+#define arv_debug_gvcp(...) 		arv_debug (&arv_debug_category_gvcp, __VA_ARGS__)
+#define arv_log_gvcp(...)		arv_log (&arv_debug_category_gvcp, __VA_ARGS__)
+#define arv_warning_gvcp(...)		arv_warning (&arv_debug_category_gvcp, __VA_ARGS__)
+
+#define arv_debug_gvsp(...) 		arv_debug (&arv_debug_category_gvsp, __VA_ARGS__)
+#define arv_log_gvsp(...)		arv_log (&arv_debug_category_gvsp, __VA_ARGS__)
+#define arv_warning_gvsp(...)		arv_warning (&arv_debug_category_gvsp, __VA_ARGS__)
+
+#define arv_debug_genicam(...) 		arv_debug (&arv_debug_category_genicam, __VA_ARGS__)
+#define arv_log_genicam(...)		arv_log (&arv_debug_category_genicam, __VA_ARGS__)
+#define arv_warning_genicam(...)		arv_warning (&arv_debug_category_genicam, __VA_ARGS__)
+
+#define arv_debug_evaluator(...) 	arv_debug (&arv_debug_category_evaluator, __VA_ARGS__)
+#define arv_log_evaluator(...)		arv_log (&arv_debug_category_evaluator, __VA_ARGS__)
+#define arv_warning_evaluator(...)	arv_warning (&arv_debug_category_evaluator, __VA_ARGS__)
+
+#define arv_debug_misc(...) 		arv_debug (&arv_debug_category_misc, __VA_ARGS__)
+#define arv_log_misc(...)		arv_log (&arv_debug_category_misc, __VA_ARGS__)
+#define arv_warning_misc(...)		arv_warning (&arv_debug_category_misc, __VA_ARGS__)
+
+void 		arv_warning 			(ArvDebugCategory *category, const char *format, ...);
+void 		arv_debug 			(ArvDebugCategory *category, const char *format, ...);
+void 		arv_log 			(ArvDebugCategory *category, const char *format, ...);
+
+gboolean	arv_debug_check			(ArvDebugCategory *category, ArvDebugLevel level);
+void		arv_debug_enable		(const char *category_selection);
+void 		arv_debug_shutdown 		(void);
 
 G_END_DECLS
 
diff --git a/src/arvevaluator.c b/src/arvevaluator.c
index 64efd98..e8389ea 100644
--- a/src/arvevaluator.c
+++ b/src/arvevaluator.c
@@ -248,18 +248,18 @@ arv_evaluator_token_debug (ArvEvaluatorToken *token, GHashTable *variables)
 	switch (token->token_id) {
 		case ARV_EVALUATOR_TOKEN_VARIABLE:
 			value = g_hash_table_lookup (variables, token->data.name);
-			arv_debug ("evaluator", "(var) %s = %g%s", token->data.name,
-				   value != NULL ? arv_value_get_double (value) : 0,
-				   value != NULL ? "" : " not found");
+			arv_log_evaluator ("(var) %s = %g%s", token->data.name,
+					   value != NULL ? arv_value_get_double (value) : 0,
+					   value != NULL ? "" : " not found");
 			break;
 		case ARV_EVALUATOR_TOKEN_CONSTANT_INT64:
-			arv_debug ("evaluator", "(int64) %Ld", token->data.v_int64);
+			arv_log_evaluator ("(int64) %Ld", token->data.v_int64);
 			break;
 		case ARV_EVALUATOR_TOKEN_CONSTANT_DOUBLE:
-			arv_debug ("evaluator", "(double) %g", token->data.v_double);
+			arv_log_evaluator ("(double) %g", token->data.v_double);
 			break;
 		default:
-			arv_debug ("evaluator", "(operator) %s", arv_evaluator_token_infos[token->token_id].tag);
+			arv_log_evaluator ("(operator) %s", arv_evaluator_token_infos[token->token_id].tag);
 	}
 }
 
@@ -822,9 +822,9 @@ evaluate (GSList *token_stack, GHashTable *variables, gint64 *v_int64, double *v
 		*v_int64 = arv_value_get_int64 (stack);
 
 	if (arv_value_holds_int64 (stack))
-		arv_debug ("evaluator", "[Evaluator::evaluate] Result = (int64) %Ld", arv_value_get_int64 (stack));
+		arv_log_evaluator ("[Evaluator::evaluate] Result = (int64) %Ld", arv_value_get_int64 (stack));
 	else
-		arv_debug ("evaluator", "[Evaluator::evaluate] Result = (double) %g", arv_value_get_double (stack));
+		arv_log_evaluator ("[Evaluator::evaluate] Result = (double) %g", arv_value_get_double (stack));
 
 	return ARV_EVALUATOR_STATUS_SUCCESS;
 CLEANUP:
@@ -847,7 +847,7 @@ parse_expression (char *expression, GSList **rpn_stack)
 	GSList *operator_stack = NULL;
 	GSList *iter;
 
-	arv_debug ("evaluator", expression);
+	arv_log_evaluator (expression);
 
 	/* Dijkstra's "shunting yard" algorithm */
 	/* http://en.wikipedia.org/wiki/Shunting-yard_algorithm */
@@ -940,9 +940,9 @@ arv_evaluator_set_error (GError **error, ArvEvaluatorStatus status)
 		     arv_evaluator_status_strings [MIN (status,
 							G_N_ELEMENTS (arv_evaluator_status_strings)-1)]);
 
-	arv_debug ("evaluator", "[Evaluator::evaluate] Error '%s'",
-		   arv_evaluator_status_strings [MIN (status,
-						      G_N_ELEMENTS (arv_evaluator_status_strings)-1)]);
+	arv_warning_evaluator ("[Evaluator::evaluate] Error '%s'",
+			       arv_evaluator_status_strings [MIN (status,
+								  G_N_ELEMENTS (arv_evaluator_status_strings)-1)]);
 }
 
 double
@@ -953,14 +953,14 @@ arv_evaluator_evaluate_as_double (ArvEvaluator *evaluator, GError **error)
 
 	g_return_val_if_fail (ARV_IS_EVALUATOR (evaluator), 0.0);
 
-	arv_debug ("evaluator", "[Evaluator::evaluate_as_double] Expression = '%s'", 
-		   evaluator->priv->expression);
+	arv_log_evaluator ("[Evaluator::evaluate_as_double] Expression = '%s'", 
+			   evaluator->priv->expression);
 
 	if (evaluator->priv->parsing_status == ARV_EVALUATOR_STATUS_NOT_PARSED) {
 		evaluator->priv->parsing_status = parse_expression (evaluator->priv->expression,
 								    &evaluator->priv->rpn_stack);
-		arv_debug ("evaluator", "[Evaluator::evaluate_as_double] Parsing status = %d",
-			   evaluator->priv->parsing_status);
+		arv_log_evaluator ("[Evaluator::evaluate_as_double] Parsing status = %d",
+				   evaluator->priv->parsing_status);
 	}
 
 	if (evaluator->priv->parsing_status != ARV_EVALUATOR_STATUS_SUCCESS) {
@@ -985,14 +985,14 @@ arv_evaluator_evaluate_as_int64 (ArvEvaluator *evaluator, GError **error)
 
 	g_return_val_if_fail (ARV_IS_EVALUATOR (evaluator), 0.0);
 
-	arv_debug ("evaluator", "[Evaluator::evaluate_as_int64] Expression = '%s'", 
-		   evaluator->priv->expression);
+	arv_log_evaluator ("[Evaluator::evaluate_as_int64] Expression = '%s'", 
+			   evaluator->priv->expression);
 
 	if (evaluator->priv->parsing_status == ARV_EVALUATOR_STATUS_NOT_PARSED) {
 		evaluator->priv->parsing_status = parse_expression (evaluator->priv->expression,
 								    &evaluator->priv->rpn_stack);
-		arv_debug ("evaluator", "[Evaluator::evaluate_as_int64] Parsing status = %d",
-			   evaluator->priv->parsing_status);
+		arv_log_evaluator ("[Evaluator::evaluate_as_int64] Parsing status = %d",
+				   evaluator->priv->parsing_status);
 	}
 
 	if (evaluator->priv->parsing_status != ARV_EVALUATOR_STATUS_SUCCESS) {
@@ -1059,8 +1059,8 @@ arv_evaluator_set_double_variable (ArvEvaluator *evaluator, const char *name, do
 			     g_strdup (name),
 			     arv_value_new_double (v_double));
 
-	arv_debug ("evaluator", "[Evaluator::set_double_variable] %s = %g",
-		   name, v_double);
+	arv_log_evaluator ("[Evaluator::set_double_variable] %s = %g",
+			   name, v_double);
 }
 
 void
@@ -1079,8 +1079,7 @@ arv_evaluator_set_int64_variable (ArvEvaluator *evaluator, const char *name, gin
 			     g_strdup (name),
 			     arv_value_new_int64 (v_int64));
 
-	arv_debug ("evaluator", "[Evaluator::set_int64_variable] %s = %Ld",
-		   name, v_int64);
+	arv_log_evaluator ("[Evaluator::set_int64_variable] %s = %Ld", name, v_int64);
 }
 
 /** 
diff --git a/src/arvfakecamera.c b/src/arvfakecamera.c
index 3c1930b..05aadba 100644
--- a/src/arvfakecamera.c
+++ b/src/arvfakecamera.c
@@ -378,10 +378,9 @@ arv_get_fake_camera_genicam_xml (size_t *size)
 		genicam_file = g_mapped_file_new (filename, FALSE, NULL);
 
 		if (genicam_file != NULL) {
-			arv_debug ("fake-genicam", "[get_fake_camera_genicam_data] %s [size = %d]",
-				   filename,
-				   g_mapped_file_get_length (genicam_file));
-			arv_debug ("fake-genicam", g_mapped_file_get_contents (genicam_file));
+			arv_debug_genicam ("[get_fake_camera_genicam_data] %s [size = %d]", filename,
+					   g_mapped_file_get_length (genicam_file));
+			arv_log_genicam (g_mapped_file_get_contents (genicam_file));
 		}
 
 		g_free (filename);
diff --git a/src/arvfakegvcamera.c b/src/arvfakegvcamera.c
index bd5ad97..ab95de8 100644
--- a/src/arvfakegvcamera.c
+++ b/src/arvfakegvcamera.c
@@ -107,7 +107,7 @@ arv_fake_gv_camera_thread (void *user_data)
 				stream_address = NULL;
 				g_object_unref (image_buffer);
 				image_buffer = NULL;
-				arv_debug ("camera", "[FakeGvCamera::stream_thread] Stop stream");
+				arv_debug_stream_thread ("[FakeGvCamera::stream_thread] Stop stream");
 			}
 			g_usleep (100000);
 		} else {
@@ -119,9 +119,10 @@ arv_fake_gv_camera_thread (void *user_data)
 				inet_address = g_inet_socket_address_get_address
 					(G_INET_SOCKET_ADDRESS (stream_address));
 				inet_address_string = g_inet_address_to_string (inet_address);
-				arv_debug ("camera", "[FakeGvCamera::stream_thread] Start stream to %s (%d)",
-					   inet_address_string,
-					   g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (stream_address)));
+				arv_debug_stream_thread ("[FakeGvCamera::stream_thread] Start stream to %s (%d)",
+							 inet_address_string,
+							 g_inet_socket_address_get_port
+							 (G_INET_SOCKET_ADDRESS (stream_address)));
 				g_free (inet_address_string);
 
 				payload = arv_fake_camera_get_payload (gv_camera->camera);
@@ -145,8 +146,8 @@ arv_fake_gv_camera_thread (void *user_data)
 			g_socket_send_to (gv_camera->gvsp_socket, stream_address,
 					  packet_buffer, packet_size, NULL, &error);
 			if (error != NULL) {
-				arv_debug ("camera", "[ArvFakeGvCamera::stream_thread] Socket send error [%s]",
-					   error->message);
+				arv_warning_stream_thread ("[ArvFakeGvCamera::stream_thread] Socket send error [%s]",
+							   error->message);
 				g_error_free (error);
 				error = NULL;
 			}
@@ -221,7 +222,7 @@ arv_fake_gv_camera_new (const char *interface_name)
 			socket_address = g_socket_address_new_from_native (ifap->ifa_addr, sizeof (struct sockaddr));
 			inet_address = g_inet_socket_address_get_address (G_INET_SOCKET_ADDRESS (socket_address));
 			gvcp_address_string = g_inet_address_to_string (inet_address);
-			arv_debug ("camera", "[FakeGvCamera::new] Interface address = %s", gvcp_address_string);
+			arv_debug_device ("[FakeGvCamera::new] Interface address = %s", gvcp_address_string);
 
 			inet_socket_address = g_inet_socket_address_new (inet_address, ARV_GVCP_PORT);
 			gv_camera->gvcp_socket = g_socket_new (G_SOCKET_FAMILY_IPV4,
@@ -247,7 +248,7 @@ arv_fake_gv_camera_new (const char *interface_name)
 									   sizeof (struct sockaddr));
 			inet_address = g_inet_socket_address_get_address (G_INET_SOCKET_ADDRESS (socket_address));
 			discovery_address_string = g_inet_address_to_string (inet_address);
-			arv_debug ("camera", "[FakeGvCamera::new] Discovery address = %s", discovery_address_string);
+			arv_debug_device ("[FakeGvCamera::new] Discovery address = %s", discovery_address_string);
 			inet_socket_address = g_inet_socket_address_new (inet_address, ARV_GVCP_PORT);
 			if (g_strcmp0 (gvcp_address_string, discovery_address_string) == 0)
 				gv_camera->discovery_socket = NULL;
@@ -353,7 +354,7 @@ handle_control_packet (ArvFakeGvCamera *gv_camera, GSocket *socket,
 			g_object_ref (gv_camera->controller_address);
 			gv_camera->controller_address = NULL;
 			write_access = TRUE;
-			arv_debug ("camera", "[FakeGvCamera::handle_control_packet] Heartbeat timeout");
+			arv_warning_device ("[FakeGvCamera::handle_control_packet] Heartbeat timeout");
 			arv_fake_camera_set_control_channel_privilege (gv_camera->camera, 0);
 		} else
 			write_access = _g_inet_socket_address_is_equal
@@ -363,21 +364,21 @@ handle_control_packet (ArvFakeGvCamera *gv_camera, GSocket *socket,
 		write_access = TRUE;
 
 
-	arv_gvcp_packet_debug (packet);
+	arv_gvcp_packet_debug (packet, ARV_DEBUG_LEVEL_LOG);
 
 	packet_count = arv_gvcp_packet_get_packet_count (packet);
 
 	switch (g_ntohs (packet->header.command)) {
 		case ARV_GVCP_COMMAND_DISCOVERY_CMD:
 			ack_packet = arv_gvcp_packet_new_discovery_ack (&ack_packet_size);
-			arv_debug ("camera", "[FakeGvCamera::handle_control_packet] Discovery command");
+			arv_debug_device ("[FakeGvCamera::handle_control_packet] Discovery command");
 			arv_fake_camera_read_memory (gv_camera->camera, 0, ARV_GVBS_DISCOVERY_DATA_SIZE,
 						     &ack_packet->data);
 			break;
 		case ARV_GVCP_COMMAND_READ_MEMORY_CMD:
 			arv_gvcp_packet_get_read_memory_cmd_infos (packet, &block_address, &block_size);
-			arv_debug ("camera", "[FakeGvCamera::handle_control_packet] Read memory command %d (%d)",
-				   block_address, block_size);
+			arv_debug_device ("[FakeGvCamera::handle_control_packet] Read memory command %d (%d)",
+					  block_address, block_size);
 			ack_packet = arv_gvcp_packet_new_read_memory_ack (block_address, block_size,
 									  packet_count, &ack_packet_size);
 			arv_fake_camera_read_memory (gv_camera->camera, block_address, block_size,
@@ -388,8 +389,8 @@ handle_control_packet (ArvFakeGvCamera *gv_camera, GSocket *socket,
 				break;
 
 			arv_gvcp_packet_get_write_memory_cmd_infos (packet, &block_address, &block_size);
-			arv_debug ("camera", "[FakeGvCamera::handle_control_packet] Write memory command %d (%d)",
-				   block_address, block_size);
+			arv_debug_device ("[FakeGvCamera::handle_control_packet] Write memory command %d (%d)",
+					  block_address, block_size);
 			arv_fake_camera_write_memory (gv_camera->camera, block_address, block_size,
 						      arv_gvcp_packet_get_write_memory_cmd_data (packet));
 			ack_packet = arv_gvcp_packet_new_write_memory_ack (block_address, packet_count,
@@ -398,8 +399,8 @@ handle_control_packet (ArvFakeGvCamera *gv_camera, GSocket *socket,
 		case ARV_GVCP_COMMAND_READ_REGISTER_CMD:
 			arv_gvcp_packet_get_read_register_cmd_infos (packet, &register_address);
 			arv_fake_camera_read_register (gv_camera->camera, register_address, &register_value);
-			arv_debug ("camera", "[FakeGvCamera::handle_control_packet] Read register command %d -> %d",
-				   register_address, register_value);
+			arv_debug_device ("[FakeGvCamera::handle_control_packet] Read register command %d -> %d",
+					  register_address, register_value);
 			ack_packet = arv_gvcp_packet_new_read_register_ack (register_value, packet_count,
 									    &ack_packet_size);
 
@@ -413,18 +414,18 @@ handle_control_packet (ArvFakeGvCamera *gv_camera, GSocket *socket,
 
 			arv_gvcp_packet_get_write_register_cmd_infos (packet, &register_address, &register_value);
 			arv_fake_camera_write_register (gv_camera->camera, register_address, register_value);
-			arv_debug ("camera", "[FakeGvCamera::handle_control_packet] Write register command %d -> %d",
+			arv_debug_device ("[FakeGvCamera::handle_control_packet] Write register command %d -> %d",
 				   register_address, register_value);
 			ack_packet = arv_gvcp_packet_new_write_register_ack (register_value, packet_count,
 									     &ack_packet_size);
 			break;
 		default:
-			arv_debug ("camera", "[FakeGvCamera::handle_control_packet] Unknown command");
+			arv_warning_device ("[FakeGvCamera::handle_control_packet] Unknown command");
 	}
 
 	if (ack_packet != NULL) {
 		g_socket_send_to (socket, remote_address, (char *) ack_packet, ack_packet_size, NULL, NULL);
-		arv_gvcp_packet_debug (ack_packet);
+		arv_gvcp_packet_debug (ack_packet, ARV_DEBUG_LEVEL_LOG);
 		g_free (ack_packet);
 	}
 
diff --git a/src/arvfakestream.c b/src/arvfakestream.c
index a86eb9d..8f0116e 100644
--- a/src/arvfakestream.c
+++ b/src/arvfakestream.c
@@ -62,7 +62,7 @@ arv_fake_stream_thread (void *data)
 	ArvFakeStreamThreadData *thread_data = data;
 	ArvBuffer *buffer;
 
-	arv_debug ("fake", "[FakeStream::thread] Start");
+	arv_log_stream_thread ("[FakeStream::thread] Start");
 
 	if (thread_data->callback != NULL)
 		thread_data->callback (thread_data->user_data, ARV_STREAM_CALLBACK_TYPE_INIT, NULL);
@@ -87,7 +87,7 @@ arv_fake_stream_thread (void *data)
 	if (thread_data->callback != NULL)
 		thread_data->callback (thread_data->user_data, ARV_STREAM_CALLBACK_TYPE_EXIT, NULL);
 
-	arv_debug ("fake", "[FakeStream::thread] Stop");
+	arv_log_stream_thread ("[FakeStream::thread] Stop");
 
 	return NULL;
 }
diff --git a/src/arvgc.c b/src/arvgc.c
index aa6cb9b..47ac015 100644
--- a/src/arvgc.c
+++ b/src/arvgc.c
@@ -91,8 +91,7 @@ arv_gc_create_node (ArvGc *genicam, const char *type)
 
 	if (node != NULL) {
 		arv_gc_node_set_genicam (node, genicam);
-		arv_debug ("parser",
-			   "[Gc::create_node] Node '%s' created", type);
+		arv_log_genicam ("[Gc::create_node] Node '%s' created", type);
 	}
 
 	return node;
@@ -194,8 +193,7 @@ arv_gc_parser_insert_node (ArvGcParserState *state, ArvGcNode *node)
 	node_name = arv_gc_node_get_name (node);
 	if (node_name != NULL) {
 		g_hash_table_insert (state->genicam->nodes, (char *) node_name, node);
-		arv_debug ("parser",
-			   "[GcParser::end_element] Insert node '%s'", node_name);
+		arv_log_genicam ("[GcParser::end_element] Insert node '%s'", node_name);
 	} else
 		g_object_unref (node);
 }
@@ -344,8 +342,8 @@ arv_gc_get_int64_from_value (ArvGc *genicam, GValue *value)
 		if (ARV_IS_GC_INTEGER (node))
 			return arv_gc_integer_get_value (ARV_GC_INTEGER (node));
 		else
-			arv_debug ("genicam", "[Gc::set_int64_to_value] Invalid node '%s'",
-				   arv_gc_node_get_name (node));
+			arv_warning_genicam ("[Gc::set_int64_to_value] Invalid node '%s'",
+					     arv_gc_node_get_name (node));
 	}
 
 	return 0;
@@ -366,8 +364,8 @@ arv_gc_set_int64_to_value (ArvGc *genicam, GValue *value, gint64 v_int64)
 		if (ARV_IS_GC_INTEGER (node))
 			arv_gc_integer_set_value (ARV_GC_INTEGER (node), v_int64);
 		else
-			arv_debug ("genicam", "[Gc::set_int64_to_value] Invalid node '%s'",
-				   arv_gc_node_get_name (node));
+			arv_warning_genicam ("[Gc::set_int64_to_value] Invalid node '%s'",
+					     arv_gc_node_get_name (node));
 	}
 }
 
@@ -386,8 +384,8 @@ arv_gc_get_double_from_value (ArvGc *genicam, GValue *value)
 		if (ARV_IS_GC_FLOAT (node))
 			return arv_gc_float_get_value (ARV_GC_FLOAT (node));
 		else
-			arv_debug ("genicam", "[Gc::set_double_to_value] Invalid node '%s'",
-				   arv_gc_node_get_name (node));
+			arv_warning_genicam ("[Gc::set_double_to_value] Invalid node '%s'",
+					     arv_gc_node_get_name (node));
 	}
 
 	return 0.0;
@@ -408,8 +406,8 @@ arv_gc_set_double_to_value (ArvGc *genicam, GValue *value, double v_double)
 		if (ARV_IS_GC_FLOAT (node))
 			arv_gc_float_set_value (ARV_GC_FLOAT (node), v_double);
 		else
-			arv_debug ("genicam", "[Gc::set_double_to_value] Invalid node '%s'",
-				   arv_gc_node_get_name (node));
+			arv_warning_genicam ("[Gc::set_double_to_value] Invalid node '%s'",
+					     arv_gc_node_get_name (node));
 	}
 }
 
diff --git a/src/arvgccommand.c b/src/arvgccommand.c
index 5f054f0..d65c21a 100644
--- a/src/arvgccommand.c
+++ b/src/arvgccommand.c
@@ -70,9 +70,9 @@ arv_gc_command_execute (ArvGcCommand *gc_command)
 	command_value = arv_gc_get_int64_from_value (genicam, &gc_command->command_value);
 	arv_gc_set_int64_to_value (genicam, &gc_command->value, command_value);
 
-	arv_debug ("genicam", "[GcCommand::execute] %s (0x%x)",
-		   arv_gc_node_get_name (ARV_GC_NODE (gc_command)),
-		   command_value);
+	arv_log_genicam ("[GcCommand::execute] %s (0x%x)",
+			 arv_gc_node_get_name (ARV_GC_NODE (gc_command)),
+			 command_value);
 }
 
 ArvGcNode *
diff --git a/src/arvgcconverter.c b/src/arvgcconverter.c
index fd4f29e..d9c9369 100644
--- a/src/arvgcconverter.c
+++ b/src/arvgcconverter.c
@@ -68,9 +68,8 @@ arv_gc_converter_add_element (ArvGcNode *node, const char *name, const char *con
 			gc_converter->variables = g_slist_prepend (gc_converter->variables,
 								     variable_infos);
 
-			arv_debug ("parser",
-				   "[GcConverter::add_element] Add pVariable '%s' named '%s'",
-				   content, variable_name);
+			arv_log_gvcp ("[GcConverter::add_element] Add pVariable '%s' named '%s'",
+				      content, variable_name);
 		}
 	} else if (strcmp (name, "FormulaTo") == 0) {
 		arv_evaluator_set_expression (gc_converter->formula_to, content);
@@ -231,9 +230,8 @@ _update_to_variables (ArvGcConverter *gc_converter)
 		arv_gc_float_set_value (ARV_GC_FLOAT (node),
 					arv_evaluator_evaluate_as_double (gc_converter->formula_to, NULL));
 	else
-		arv_debug ("genicam",
-			   "[GcConverter::set_value] Invalid pValue node '%s'",
-			   gc_converter->value);
+		arv_warning_genicam ("[GcConverter::set_value] Invalid pValue node '%s'",
+				     gc_converter->value);
 }
 
 static gint64
diff --git a/src/arvgcenumeration.c b/src/arvgcenumeration.c
index e8d0627..9a7ae41 100644
--- a/src/arvgcenumeration.c
+++ b/src/arvgcenumeration.c
@@ -77,13 +77,13 @@ arv_gc_enumeration_get_string_value (ArvGcEnumeration *enumeration)
 			const char *string;
 
 			string = arv_gc_node_get_name (iter->data);
-			arv_debug ("genicam", "[GcEnumeration::get_string_value] value = %Ld - string = %s",
-				   value, string);
+			arv_log_genicam ("[GcEnumeration::get_string_value] value = %Ld - string = %s",
+					 value, string);
 			return string;
 		}
 	}
 
-	arv_debug ("genicam", "[GcEnumeration::get_string_value] value = %Ld not found", value);
+	arv_warning_genicam ("[GcEnumeration::get_string_value] value = %Ld not found", value);
 
 	return NULL;
 }
@@ -97,15 +97,15 @@ arv_gc_enumeration_set_string_value (ArvGcEnumeration *enumeration, const char *
 
 	for (iter = arv_gc_node_get_childs (ARV_GC_NODE (enumeration)); iter != NULL; iter = iter->next)
 		if (g_strcmp0 (arv_gc_node_get_name (iter->data), value) == 0) {
-			arv_debug ("genicam", "[GcEnumeration::set_string_value] value = %d - string = %s",
-				   &enumeration->value, value);
+			arv_log_genicam ("[GcEnumeration::set_string_value] value = %d - string = %s",
+					 &enumeration->value, value);
 			arv_gc_set_int64_to_value (arv_gc_node_get_genicam (ARV_GC_NODE (enumeration)),
 						   &enumeration->value,
 						   arv_gc_enum_entry_get_value (iter->data));
 			return;
 		}
 
-	arv_debug ("genicam", "[GcEnumeration::set_string_value] entry %s not found", value);
+	arv_warning_genicam ("[GcEnumeration::set_string_value] entry %s not found", value);
 }
 
 gint64
diff --git a/src/arvgcnode.c b/src/arvgcnode.c
index 722d6df..d4d246b 100644
--- a/src/arvgcnode.c
+++ b/src/arvgcnode.c
@@ -125,8 +125,8 @@ arv_gc_node_add_element (ArvGcNode *node, const char *name, const char *content,
 	g_return_if_fail (ARV_IS_GC_NODE (node));
 	g_return_if_fail (name != NULL);
 
-	arv_debug ("parser", "[GcNode::add_element] Add %s [%s]",
-		   name, content);
+	arv_log_genicam ("[GcNode::add_element] Add %s [%s]",
+			 name, content);
 
 	ARV_GC_NODE_GET_CLASS (node)->add_element (node, name, content, attributes);
 }
diff --git a/src/arvgcregister.c b/src/arvgcregister.c
index 1f7c669..7881cef 100644
--- a/src/arvgcregister.c
+++ b/src/arvgcregister.c
@@ -169,7 +169,7 @@ _read_cache (ArvGcRegister *gc_register)
 	ArvGcNode *port;
 
 	if (gc_register->is_cache_valid == TRUE) {
-		arv_debug ("genicam", "[GcRegister::read_cache] Cache is valid");
+		arv_log_genicam ("[GcRegister::read_cache] Cache is valid");
 		return;
 	}
 
@@ -234,8 +234,8 @@ arv_gc_register_get (ArvGcRegister *gc_register, void *buffer, guint64 length)
 	} else
 		memcpy (buffer, gc_register->cache, length);
 
-	arv_debug ("genicam", "[GcRegister::get] 0x%Lx,%Ld",
-		   arv_gc_register_get_address (gc_register), length);
+	arv_log_genicam ("[GcRegister::get] 0x%Lx,%Ld",
+			 arv_gc_register_get_address (gc_register), length);
 }
 
 void
@@ -251,8 +251,7 @@ arv_gc_register_set (ArvGcRegister *gc_register, void *buffer, guint64 length)
 
 	_write_cache (gc_register);
 
-	arv_debug ("genicam", "[GcRegister::set] 0x%Lx,%Ld",
-		   arv_gc_register_get_address (gc_register), length);
+	arv_log_genicam ("[GcRegister::set] 0x%Lx,%Ld", arv_gc_register_get_address (gc_register), length);
 }
 
 guint64
@@ -469,9 +468,9 @@ arv_gc_register_get_integer_value (ArvGcInteger *gc_integer)
 #endif
 	}
 
-	arv_debug ("genicam", "[GcRegister::get_integer_value] address = 0x%Lx, value = 0x%Lx",
-		   arv_gc_register_get_address (gc_register),
-		   value);
+	arv_log_genicam ("[GcRegister::get_integer_value] address = 0x%Lx, value = 0x%Lx",
+			 arv_gc_register_get_address (gc_register),
+			 value);
 
 	return value;
 }
@@ -512,9 +511,9 @@ arv_gc_register_set_integer_value (ArvGcInteger *gc_integer, gint64 value)
 #endif
 	}
 
-	arv_debug ("genicam", "[GcRegister::set_integer_value] address = 0x%Lx, value = 0x%Lx",
-		   arv_gc_register_get_address (gc_register),
-		   value);
+	arv_log_genicam ("[GcRegister::set_integer_value] address = 0x%Lx, value = 0x%Lx",
+			 arv_gc_register_get_address (gc_register),
+			 value);
 
 	arv_copy_memory_with_endianess (gc_register->cache, gc_register->cache_size, gc_register->endianess,
 					&value, sizeof (value), G_BYTE_ORDER);
@@ -549,7 +548,7 @@ arv_gc_register_get_float_value (ArvGcFloat *gc_float)
 
 		return v_double;
 	} else {
-		arv_debug ("genicam", "[GcFloatReg::get_value] Invalid register size");
+		arv_warning_genicam ("[GcFloatReg::get_value] Invalid register size");
 		return 0.0;
 	}
 }
@@ -573,7 +572,7 @@ arv_gc_register_set_float_value (ArvGcFloat *gc_float, double v_double)
 		arv_copy_memory_with_endianess (gc_register->cache, gc_register->cache_size, gc_register->endianess,
 						&v_double, sizeof (v_double), G_BYTE_ORDER);
 	} else {
-		arv_debug ("genicam", "[GcFloatReg::set_value] Invalid register size");
+		arv_warning_genicam ("[GcFloatReg::set_value] Invalid register size");
 		return;
 	}
 
diff --git a/src/arvgcswissknife.c b/src/arvgcswissknife.c
index 377e2d9..66009b3 100644
--- a/src/arvgcswissknife.c
+++ b/src/arvgcswissknife.c
@@ -67,9 +67,8 @@ arv_gc_swiss_knife_add_element (ArvGcNode *node, const char *name, const char *c
 			gc_swiss_knife->variables = g_slist_prepend (gc_swiss_knife->variables,
 								     variable_infos);
 
-			arv_debug ("parser",
-				   "[GcSwissKnife::add_element] Add pVariable '%s' named '%s'",
-				   content, variable_name);
+			arv_log_genicam ("[GcSwissKnife::add_element] Add pVariable '%s' named '%s'",
+					 content, variable_name);
 		}
 	} else if (strcmp (name, "Formula") == 0) {
 		arv_evaluator_set_expression (gc_swiss_knife->formula, content);
diff --git a/src/arvgvcp.c b/src/arvgvcp.c
index e5e04f7..2f68876 100644
--- a/src/arvgvcp.c
+++ b/src/arvgvcp.c
@@ -535,14 +535,26 @@ arv_gvcp_packet_to_string (const ArvGvcpPacket *packet)
 }
 
 void
-arv_gvcp_packet_debug (const ArvGvcpPacket *packet)
+arv_gvcp_packet_debug (const ArvGvcpPacket *packet, ArvDebugLevel level)
 {
 	char *string;
 
-	if (!arv_debug_check ("gvcp"))
+	if (!arv_debug_check (&arv_debug_category_gvcp, level))
 		return;
 
 	string = arv_gvcp_packet_to_string (packet);
-	arv_debug ("gvcp", "%s", string);
+	switch (level) {
+		case ARV_DEBUG_LEVEL_LOG:
+			arv_log_gvcp ("%s", string);
+			break;
+		case ARV_DEBUG_LEVEL_DEBUG:
+			arv_debug_gvcp ("%", string);
+			break;
+		case ARV_DEBUG_LEVEL_WARNING:
+			arv_warning_gvcp ("%s", string);
+			break;
+		default:
+			break;
+	}
 	g_free (string);
 }
diff --git a/src/arvgvcp.h b/src/arvgvcp.h
index 564b22e..39fe7e7 100644
--- a/src/arvgvcp.h
+++ b/src/arvgvcp.h
@@ -24,6 +24,7 @@
 #define ARV_GVCP_H
 
 #include <arvtypes.h>
+#include <arvdebug.h>
 
 G_BEGIN_DECLS
 
@@ -200,7 +201,7 @@ ArvGvcpPacket * 	arv_gvcp_packet_new_packet_resend_cmd 	(guint32 frame_id,
 								 guint32 first_block, guint32 last_block,
 								 guint32 packet_count, size_t *packet_size);
 char * 			arv_gvcp_packet_to_string 		(const ArvGvcpPacket *packet);
-void 			arv_gvcp_packet_debug 			(const ArvGvcpPacket *packet);
+void 			arv_gvcp_packet_debug 			(const ArvGvcpPacket *packet, ArvDebugLevel level);
 
 static inline ArvGvcpPacketType
 arv_gvcp_packet_get_packet_type (ArvGvcpPacket *packet)
diff --git a/src/arvgvdevice.c b/src/arvgvdevice.c
index bc6c843..a7e0ea0 100644
--- a/src/arvgvdevice.c
+++ b/src/arvgvdevice.c
@@ -95,7 +95,7 @@ _read_memory (ArvGvDeviceIOData *io_data, guint32 address, guint32 size, void *b
 	do {
 		arv_gvcp_packet_set_packet_count (packet, ++io_data->packet_count);
 
-		arv_gvcp_packet_debug (packet);
+		arv_gvcp_packet_debug (packet, ARV_DEBUG_LEVEL_LOG);
 
 		g_socket_send_to (io_data->socket, io_data->device_address,
 				  (const char *) packet, packet_size,
@@ -110,7 +110,7 @@ _read_memory (ArvGvDeviceIOData *io_data, guint32 address, guint32 size, void *b
 				ArvGvcpCommand command;
 				guint16 packet_count;
 
-				arv_gvcp_packet_debug (ack_packet);
+				arv_gvcp_packet_debug (ack_packet, ARV_DEBUG_LEVEL_LOG);
 
 				packet_type = arv_gvcp_packet_get_packet_type (ack_packet);
 				command = arv_gvcp_packet_get_command (ack_packet);
@@ -159,7 +159,7 @@ _write_memory (ArvGvDeviceIOData *io_data, guint32 address, guint32 size, void *
 	do {
 		arv_gvcp_packet_set_packet_count (packet, ++io_data->packet_count);
 
-		arv_gvcp_packet_debug (packet);
+		arv_gvcp_packet_debug (packet, ARV_DEBUG_LEVEL_LOG);
 
 		g_socket_send_to (io_data->socket, io_data->device_address,
 				  (const char *) packet, packet_size,
@@ -174,7 +174,7 @@ _write_memory (ArvGvDeviceIOData *io_data, guint32 address, guint32 size, void *
 				ArvGvcpCommand command;
 				guint16 packet_count;
 
-				arv_gvcp_packet_debug (ack_packet);
+				arv_gvcp_packet_debug (ack_packet, ARV_DEBUG_LEVEL_LOG);
 
 				packet_type = arv_gvcp_packet_get_packet_type (ack_packet);
 				command = arv_gvcp_packet_get_command (ack_packet);
@@ -217,7 +217,7 @@ _read_register (ArvGvDeviceIOData *io_data, guint32 address, guint32 *value_plac
 	do {
 		arv_gvcp_packet_set_packet_count (packet, ++io_data->packet_count);
 
-		arv_gvcp_packet_debug (packet);
+		arv_gvcp_packet_debug (packet, ARV_DEBUG_LEVEL_LOG);
 
 		g_socket_send_to (io_data->socket, io_data->device_address,
 				  (const char *) packet, packet_size,
@@ -232,7 +232,7 @@ _read_register (ArvGvDeviceIOData *io_data, guint32 address, guint32 *value_plac
 				ArvGvcpCommand command;
 				guint16 packet_count;
 
-				arv_gvcp_packet_debug (ack_packet);
+				arv_gvcp_packet_debug (ack_packet, ARV_DEBUG_LEVEL_LOG);
 
 				packet_type = arv_gvcp_packet_get_packet_type (ack_packet);
 				command = arv_gvcp_packet_get_command (ack_packet);
@@ -279,7 +279,7 @@ _write_register (ArvGvDeviceIOData *io_data, guint32 address, guint32 value)
 	do {
 		arv_gvcp_packet_set_packet_count (packet, ++io_data->packet_count);
 
-		arv_gvcp_packet_debug (packet);
+		arv_gvcp_packet_debug (packet, ARV_DEBUG_LEVEL_LOG);
 
 		g_socket_send_to (io_data->socket, io_data->device_address, (const char *) packet, packet_size,
 				  NULL, NULL);
@@ -293,13 +293,13 @@ _write_register (ArvGvDeviceIOData *io_data, guint32 address, guint32 value)
 				ArvGvcpCommand command;
 				guint16 packet_count;
 
-				arv_gvcp_packet_debug (ack_packet);
+				arv_gvcp_packet_debug (ack_packet, ARV_DEBUG_LEVEL_LOG);
 
 				packet_type = arv_gvcp_packet_get_packet_type (ack_packet);
 				command = arv_gvcp_packet_get_command (ack_packet);
 				packet_count = arv_gvcp_packet_get_packet_count (ack_packet);
 
-				arv_debug ("gvcp", "%d, %d, %d", packet_type, command, packet_count);
+				arv_log_gvcp ("%d, %d, %d", packet_type, command, packet_count);
 
 				if (packet_type == ARV_GVCP_PACKET_TYPE_ACK &&
 				    command == ARV_GVCP_COMMAND_WRITE_REGISTER_ACK &&
@@ -345,11 +345,11 @@ arv_gv_device_heartbeat_thread (void *data)
 
 			g_usleep (thread_data->period_us);
 			_read_register (io_data, ARV_GVBS_CONTROL_CHANNEL_PRIVILEGE_OFFSET, &value);
-			arv_debug ("device", "[GvDevice::Heartbeat] (%d)", value);
+			arv_log_device ("[GvDevice::Heartbeat] (%d)", value);
 
 			if ((value & (ARV_GVBS_CONTROL_CHANNEL_PRIVILEGE_CONTROL |
 				      ARV_GVBS_CONTROL_CHANNEL_PRIVILEGE_EXCLUSIVE)) == 0) {
-				arv_debug ("device", "[GvDevice::Heartbeat] Control access lost");
+				arv_warning_device ("[GvDevice::Heartbeat] Control access lost");
 				io_data->is_controller = FALSE;
 			}
 		}
@@ -372,7 +372,7 @@ arv_gv_device_take_control (ArvGvDevice *gv_device)
 	gv_device->priv->io_data->is_controller = success;
 
 	if (!success)
-		arv_debug ("device", "[GvDevice::take_control] Can't get control access");
+		arv_warning_device ("[GvDevice::take_control] Can't get control access");
 
 	return success;
 }
@@ -454,7 +454,7 @@ _load_genicam (ArvGvDevice *gv_device, guint32 address, size_t  *size)
 
 	filename[ARV_GVBS_XML_URL_SIZE - 1] = '\0';
 
-	arv_debug ("device", "[GvDevice::load_genicam] xml url = '%s' at 0x%x", filename, address);
+	arv_debug_device ("[GvDevice::load_genicam] xml url = '%s' at 0x%x", filename, address);
 
 	tokens = g_regex_split (arv_gv_device_url_regex, filename, 0);
 
@@ -471,9 +471,8 @@ _load_genicam (ArvGvDevice *gv_device, guint32 address, size_t  *size)
 			file_address = strtoul (tokens[3], NULL, 16);
 			file_size = strtoul (tokens[4], NULL, 16);
 
-			arv_debug ("device",
-				   "[GvDevice::load_genicam] Xml address = 0x%x - size = 0x%x - %s",
-				   file_address, file_size, tokens[2]);
+			arv_debug_device ("[GvDevice::load_genicam] Xml address = 0x%x - size = 0x%x - %s",
+					  file_address, file_size, tokens[2]);
 
 			if (file_size > 0) {
 				genicam = g_malloc (file_size);
@@ -485,8 +484,7 @@ _load_genicam (ArvGvDevice *gv_device, guint32 address, size_t  *size)
 						ArvZip *zip;
 						const GSList *zip_files;
 
-						arv_debug ("device",
-							   "[GvDevice::load_genicam] Zipped xml data");
+						arv_debug_device ("[GvDevice::load_genicam] Zipped xml data");
 
 						zip = arv_zip_new (genicam, file_size);
 						zip_files = arv_zip_get_file_list (zip);
@@ -504,8 +502,7 @@ _load_genicam (ArvGvDevice *gv_device, guint32 address, size_t  *size)
 							file_size = tmp_buffer_size;
 							genicam = tmp_buffer;
 						} else
-							arv_debug ("device",
-								   "[GvDevice::load_genicam] Invalid format");
+							arv_warning_device ("[GvDevice::load_genicam] Invalid format");
 						arv_zip_free (zip);
 					}
 					*size = file_size;
@@ -574,13 +571,13 @@ arv_gv_device_create_stream (ArvDevice *device, ArvStreamCallback callback, void
 	GInetAddress *device_address;
 
 	arv_device_read_register (device, ARV_GVBS_N_STREAM_CHANNELS_OFFSET, &n_stream_channels);
-	arv_debug ("device", "[GvDevice::create_stream] Nimber of stream channels = %d", n_stream_channels);
+	arv_debug_device ("[GvDevice::create_stream] Number of stream channels = %d", n_stream_channels);
 
 	if (n_stream_channels < 1)
 		return NULL;
 
 	if (!io_data->is_controller) {
-		arv_debug ("device", "[GvDevice::create_stream] Can't create stream without control access");
+		arv_warning_device ("[GvDevice::create_stream] Can't create stream without control access");
 		return NULL;
 	}
 
@@ -591,7 +588,7 @@ arv_gv_device_create_stream (ArvDevice *device, ArvStreamCallback callback, void
 	arv_gv_device_set_packet_size (gv_device, ARV_GV_DEVICE_GVSP_PACKET_SIZE_DEFAULT);
 	packet_size = arv_gv_device_get_packet_size (gv_device);
 
-	arv_debug ("device", "[GvDevice::create_stream] Packet size = %d byte(s)", packet_size);
+	arv_debug_device ("[GvDevice::create_stream] Packet size = %d byte(s)", packet_size);
 
 	stream = arv_gv_stream_new (device_address, 0, callback, user_data,
 				    arv_gv_device_get_timestamp_tick_frequency (gv_device), packet_size);
@@ -602,7 +599,7 @@ arv_gv_device_create_stream (ArvDevice *device, ArvStreamCallback callback, void
 				   g_htonl(*((guint32 *) address_bytes)));
 	arv_device_write_register (device, ARV_GVBS_STREAM_CHANNEL_0_PORT_OFFSET, stream_port);
 
-	arv_debug ("device", "[GvDevice::create_stream] stream port = %d", stream_port);
+	arv_debug_device ("[GvDevice::create_stream] stream port = %d", stream_port);
 
 	return stream;
 }
@@ -679,10 +676,10 @@ arv_gv_device_new (GInetAddress *interface_address, GInetAddress *device_address
 	g_return_val_if_fail (G_IS_INET_ADDRESS (device_address), NULL);
 
 	address_string = g_inet_address_to_string (interface_address);
-	arv_debug ("device", "[GvDevice::new] Interface address = %s", address_string);
+	arv_debug_device ("[GvDevice::new] Interface address = %s", address_string);
 	g_free (address_string);
 	address_string = g_inet_address_to_string (device_address);
-	arv_debug ("device", "[GvDevice::new] Device address = %s", address_string);
+	arv_debug_device ("[GvDevice::new] Device address = %s", address_string);
 	g_free (address_string);
 
 	gv_device = g_object_new (ARV_TYPE_GV_DEVICE, NULL);
diff --git a/src/arvgvinterface.c b/src/arvgvinterface.c
index 636e18d..1f0c0d0 100644
--- a/src/arvgvinterface.c
+++ b/src/arvgvinterface.c
@@ -126,8 +126,8 @@ arv_gv_interface_build_discover_infos_list (ArvGvInterface *gv_interface)
 			socket_address = g_socket_address_new_from_native (ifap->ifa_addr, sizeof (struct sockaddr));
 			inet_address = g_inet_socket_address_get_address (G_INET_SOCKET_ADDRESS (socket_address));
 			inet_address_string = g_inet_address_to_string (inet_address);
-			arv_debug ("interface", "[GvInterface::build_discover_infos_list] Add interface %s",
-				   inet_address_string);
+			arv_debug_interface ("[GvInterface::build_discover_infos_list] Add interface %s",
+					     inet_address_string);
 			g_free (inet_address_string);
 			infos->interface_address = g_inet_socket_address_new (inet_address, 0);
 			g_object_unref (socket_address);
@@ -137,8 +137,8 @@ arv_gv_interface_build_discover_infos_list (ArvGvInterface *gv_interface)
 			inet_address = g_inet_socket_address_get_address (G_INET_SOCKET_ADDRESS (socket_address));
 			infos->broadcast_address = g_inet_socket_address_new (inet_address, ARV_GVCP_PORT);
 			inet_address_string = g_inet_address_to_string (inet_address);
-			arv_debug ("interface", "[GvInterface::build_discover_infos_list] Broadcast address is %s",
-				   inet_address_string);
+			arv_debug_interface ("[GvInterface::build_discover_infos_list] Broadcast address is %s",
+					     inet_address_string);
 			g_free (inet_address_string);
 			g_object_unref (socket_address);
 
@@ -247,7 +247,7 @@ arv_gv_interface_receive_hello_packet (ArvGvInterface *gv_interface)
 						char *manufacturer;
 						char *key;
 
-						arv_gvcp_packet_debug (packet);
+						arv_gvcp_packet_debug (packet, ARV_DEBUG_LEVEL_LOG);
 
 						manufacturer = g_strndup (&data[ARV_GVBS_MANUFACTURER_NAME_OFFSET],
 									  ARV_GVBS_MANUFACTURER_NAME_SIZE);
@@ -263,9 +263,9 @@ arv_gv_interface_receive_hello_packet (ArvGvInterface *gv_interface)
 												  data);
 						address_string = g_inet_address_to_string (interface_address);
 
-						arv_debug ("interface",
-							   "[GvInterface::discovery] Device '%s' found (interface %s)",
-							   key, address_string);
+						arv_debug_interface ("[GvInterface::discovery] Device '%s' found "
+								     "(interface %s)",
+								     key, address_string);
 
 						g_free (address_string);
 
diff --git a/src/arvgvsp.c b/src/arvgvsp.c
index cbaefbe..8e799b1 100644
--- a/src/arvgvsp.c
+++ b/src/arvgvsp.c
@@ -209,14 +209,26 @@ arv_gvsp_packet_to_string (const ArvGvspPacket *packet, size_t packet_size)
 }
 
 void
-arv_gvsp_packet_debug (const ArvGvspPacket *packet, size_t packet_size)
+arv_gvsp_packet_debug (const ArvGvspPacket *packet, size_t packet_size, ArvDebugLevel level)
 {
 	char *string;
 
-	if (!arv_debug_check ("gvsp"))
+	if (!arv_debug_check (&arv_debug_category_gvsp, level))
 		return;
 
 	string = arv_gvsp_packet_to_string (packet, packet_size);
-	arv_debug ("gvsp", "%s", string);
+	switch (level) {
+		case ARV_DEBUG_LEVEL_LOG:
+			arv_log_gvsp ("%s", string);
+			break;
+		case ARV_DEBUG_LEVEL_DEBUG:
+			arv_debug_gvsp ("%", string);
+			break;
+		case ARV_DEBUG_LEVEL_WARNING:
+			arv_warning_gvsp ("%s", string);
+			break;
+		default:
+			break;
+	}
 	g_free (string);
 }
diff --git a/src/arvgvsp.h b/src/arvgvsp.h
index dc00304..3f57b5c 100644
--- a/src/arvgvsp.h
+++ b/src/arvgvsp.h
@@ -24,6 +24,7 @@
 #define ARV_GVSP_H
 
 #include <arvtypes.h>
+#include <arvdebug.h>
 
 G_BEGIN_DECLS
 
@@ -76,7 +77,8 @@ ArvGvspPacket *		arv_gvsp_packet_new_data_block		(guint32 frame_id, guint32 pack
 								 size_t size, void *data,
 								 void *buffer, size_t *buffer_size);
 char * 			arv_gvsp_packet_to_string 		(const ArvGvspPacket *packet, size_t packet_size);
-void 			arv_gvsp_packet_debug 			(const ArvGvspPacket *packet, size_t packet_size);
+void 			arv_gvsp_packet_debug 			(const ArvGvspPacket *packet, size_t packet_size,
+								 ArvDebugLevel level);
 
 static inline ArvGvspPacketType
 arv_gvsp_packet_get_packet_type	(const ArvGvspPacket *packet)
diff --git a/src/arvgvstream.c b/src/arvgvstream.c
index bf9e1d1..d407c99 100644
--- a/src/arvgvstream.c
+++ b/src/arvgvstream.c
@@ -130,10 +130,10 @@ _send_packet_request (ArvGvStreamThreadData *thread_data,
 	packet = arv_gvcp_packet_new_packet_resend_cmd (frame_id, first_block, last_block,
 							thread_data->packet_count++, &packet_size);
 
-	arv_debug ("stream-thread", "[GvStream::send_packet_request] frame_id = %u (%d - %d)",
-		   frame_id, first_block, last_block);
+	arv_log_stream_thread ("[GvStream::send_packet_request] frame_id = %u (%d - %d)",
+			       frame_id, first_block, last_block);
 
-	arv_gvcp_packet_debug (packet);
+	arv_gvcp_packet_debug (packet, ARV_DEBUG_LEVEL_LOG);
 
 	g_socket_send_to (thread_data->socket, thread_data->device_address, (const char *) packet, packet_size,
 			  NULL, NULL);
@@ -167,8 +167,7 @@ _update_socket (ArvGvStreamThreadData *thread_data, ArvBuffer *buffer)
 	if (buffer_size != thread_data->current_socket_buffer_size) {
 		setsockopt (fd, SOL_SOCKET, SO_RCVBUF, &buffer_size, sizeof (buffer_size));
 		thread_data->current_socket_buffer_size = buffer_size;
-		arv_debug ("stream-thread", "[GvStream::update_socket] Socket buffer size set to %d",
-			 buffer_size);
+		arv_debug_stream_thread ("[GvStream::update_socket] Socket buffer size set to %d", buffer_size);
 	}
 }
 
@@ -198,8 +197,8 @@ _process_data_leader (ArvGvStreamThreadData *thread_data,
 
 	if (frame->packet_data[packet_id].time_us > 0) {
 		thread_data->n_resent_packets++;
-		arv_debug ("stream-thread", "[GvStream::_process_data_leader] Received resent packet %u for frame %u",
-			   packet_id, frame->frame_id);
+		arv_log_stream_thread ("[GvStream::_process_data_leader] Received resent packet %u for frame %u",
+				       packet_id, frame->frame_id);
 	}
 }
 
@@ -218,7 +217,7 @@ _process_data_block (ArvGvStreamThreadData *thread_data,
 		return;
 
 	if (packet_id > frame->n_packets - 2) {
-		arv_gvsp_packet_debug (packet, read_count);
+		arv_gvsp_packet_debug (packet, read_count, ARV_DEBUG_LEVEL_DEBUG);
 		frame->buffer->status = ARV_BUFFER_STATUS_WRONG_PACKET_ID;
 		return;
 	}
@@ -228,10 +227,10 @@ _process_data_block (ArvGvStreamThreadData *thread_data,
 	block_end = block_size + block_offset;
 
 	if (block_end > frame->buffer->size) {
-		arv_debug ("stream-thread", "[GvStream::_process_data_block] %d unexpected bytes in packet %u"
-			   " for frame %u",
-			   block_end, frame->buffer->size,
-			   packet_id, frame->frame_id);
+		arv_debug_stream_thread ("[GvStream::_process_data_block] %d unexpected bytes in packet %u "
+					 " for frame %u",
+					 block_end, frame->buffer->size,
+					 packet_id, frame->frame_id);
 		thread_data->n_size_mismatch_errors++;
 
 		block_end = frame->buffer->size;
@@ -242,8 +241,8 @@ _process_data_block (ArvGvStreamThreadData *thread_data,
 
 	if (frame->packet_data[packet_id].time_us > 0) {
 		thread_data->n_resent_packets++;
-		arv_debug ("stream-thread", "[GvStream::_process_data_block] Received resent packet %u for frame %u",
-			   packet_id, frame->frame_id);
+		arv_log_stream_thread ("[GvStream::_process_data_block] Received resent packet %u for frame %u",
+				       packet_id, frame->frame_id);
 	}
 }
 
@@ -263,8 +262,8 @@ _process_data_trailer (ArvGvStreamThreadData *thread_data,
 
 	if (frame->packet_data[packet_id].time_us > 0) {
 		thread_data->n_resent_packets++;
-		arv_debug ("stream-thread", "[GvStream::_process_data_trailer] Received resent packet %u for frame %u",
-			   packet_id, frame->frame_id);
+		arv_log_stream_thread ("[GvStream::_process_data_trailer] Received resent packet %u for frame %u",
+				       packet_id, frame->frame_id);
 	}
 }
 
@@ -326,16 +325,15 @@ _find_frame_data (ArvGvStreamThreadData *thread_data,
 			thread_data->last_frame_id = frame_id;
 			if (frame_id_inc != 1) {
 				thread_data->n_missing_frames++;
-				arv_debug ("stream-thread", "[GvStream::_find_frame_data]"
-					   " Missed %d frame(s) before %u",
-					   frame_id_inc - 1, frame_id);
+				arv_log_stream_thread ("[GvStream::_find_frame_data] Missed %d frame(s) before %u",
+						       frame_id_inc - 1, frame_id);
 			}
 		}
 	}
 
 	thread_data->frames = g_slist_append (thread_data->frames, frame);
 
-	arv_debug ("stream-thread", "[GvStream::_find_frame_data] Start frame %u", frame_id);
+	arv_log_stream_thread ("[GvStream::_find_frame_data] Start frame %u", frame_id);
 
 	return frame;
 }
@@ -364,10 +362,10 @@ _missing_packet_check (ArvGvStreamThreadData *thread_data,
 				if (first_missing >= 0) {
 					int j;
 
-					arv_debug ("stream-thread", "[GvStream::_missing_packet_check]"
-						   " Resend request at dt = %Lu, packet id = %u/%u",
-						   time_us - frame->first_packet_time_us,
-						   packet_id, frame->n_packets);
+					arv_log_stream_thread ("[GvStream::_missing_packet_check]"
+							       " Resend request at dt = %Lu, packet id = %u/%u",
+							       time_us - frame->first_packet_time_us,
+							       packet_id, frame->n_packets);
 
 					_send_packet_request (thread_data, frame->frame_id,
 							      first_missing, i - 1);
@@ -382,10 +380,10 @@ _missing_packet_check (ArvGvStreamThreadData *thread_data,
 		if (first_missing >= 0) {
 			int j;
 
-			arv_debug ("stream-thread", "[GvStream::_missing_packet_check]"
-				   " Resend request at dt = %Lu, packet id = %u/%u",
-				   time_us - frame->first_packet_time_us,
-				   packet_id, frame->n_packets);
+			arv_log_stream_thread ("[GvStream::_missing_packet_check]"
+					       " Resend request at dt = %Lu, packet id = %u/%u",
+					       time_us - frame->first_packet_time_us,
+					       packet_id, frame->n_packets);
 
 			_send_packet_request (thread_data, frame->frame_id,
 					      first_missing, i - 1);
@@ -434,7 +432,7 @@ _close_frame (ArvGvStreamThreadData *thread_data, ArvGvStreamFrameData *frame)
 
 	arv_stream_push_output_buffer (thread_data->stream, frame->buffer);
 
-	arv_debug ("stream-thread", "[GvStream::_close_frame] Close frame %u", frame->frame_id);
+	arv_log_stream_thread ("[GvStream::_close_frame] Close frame %u", frame->frame_id);
 
 	frame->buffer = NULL;
 	frame->frame_id = 0;
@@ -459,8 +457,8 @@ _check_frame_completion (ArvGvStreamThreadData *thread_data,
 		    thread_data->packet_resend == ARV_GV_STREAM_PACKET_RESEND_NEVER &&
 		    iter->next != NULL) {
 			frame->buffer->status = ARV_BUFFER_STATUS_MISSING_PACKETS;
-			arv_debug ("stream-thread", "[GvStream::_check_frame_completion] Incomplete frame %u",
-				   frame->frame_id);
+			arv_debug_stream_thread ("[GvStream::_check_frame_completion] Incomplete frame %u",
+						 frame->frame_id);
 			_close_frame (thread_data, frame);
 			thread_data->frames = iter->next;
 			g_slist_free_1 (iter);
@@ -471,8 +469,8 @@ _check_frame_completion (ArvGvStreamThreadData *thread_data,
 		if (can_close_frame &&
 		    frame->last_valid_packet == frame->n_packets - 1) {
 			frame->buffer->status = ARV_BUFFER_STATUS_SUCCESS;
-			arv_debug ("stream-thread", "[GvStream::_check_frame_completion] Completed frame %u",
-				   frame->frame_id);
+			arv_log_stream_thread ("[GvStream::_check_frame_completion] Completed frame %u",
+					       frame->frame_id);
 			_close_frame (thread_data, frame);
 			thread_data->frames = iter->next;
 			g_slist_free_1 (iter);
@@ -483,8 +481,8 @@ _check_frame_completion (ArvGvStreamThreadData *thread_data,
 		if (can_close_frame &&
 		    time_us - frame->last_packet_time_us >= thread_data->frame_retention_us) {
 			frame->buffer->status = ARV_BUFFER_STATUS_TIMEOUT;
-			arv_debug ("stream-thread", "[GvStream::_check_frame_completion] Timeout for frame %u",
-				   frame->frame_id);
+			arv_debug_stream_thread ("[GvStream::_check_frame_completion] Timeout for frame %u",
+						 frame->frame_id);
 			_close_frame (thread_data, frame);
 			thread_data->frames = iter->next;
 			g_slist_free_1 (iter);
@@ -834,34 +832,34 @@ arv_gv_stream_finalize (GObject *object)
 		g_object_unref (thread_data->device_address);
 
 		statistic_string = arv_statistic_to_string (thread_data->statistic);
-		arv_debug ("stream", statistic_string);
+		arv_debug_stream (statistic_string);
 		g_free (statistic_string);
 		arv_statistic_free (thread_data->statistic);
 
-		arv_debug ("stream",
-			   "[GvStream::finalize] n_completed_buffers    = %d", thread_data->n_completed_buffers);
-		arv_debug ("stream",
-			   "[GvStream::finalize] n_failures             = %d", thread_data->n_failures);
-		arv_debug ("stream",
-			   "[GvStream::finalize] n_timeouts             = %d", thread_data->n_timeouts);
-		arv_debug ("stream",
-			   "[GvStream::finalize] n_aborteds             = %d", thread_data->n_aborteds);
-		arv_debug ("stream",
-			   "[GvStream::finalize] n_underruns            = %d", thread_data->n_underruns);
-		arv_debug ("stream",
-			   "[GvStream::finalize] n_size_mismatch_errors = %d", thread_data->n_size_mismatch_errors);
-		arv_debug ("stream",
-			   "[GvStream::finalize] n_missing_packets      = %d", thread_data->n_missing_packets);
-		arv_debug ("stream",
-			   "[GvStream::finalize] n_late_packets         = %d", thread_data->n_late_packets);
-		arv_debug ("stream",
-			   "[GvStream::finalize] n_resend_requests      = %d", thread_data->n_resend_requests);
-		arv_debug ("stream",
-			   "[GvStream::finalize] n_resent_packets       = %d", thread_data->n_resent_packets);
-		arv_debug ("stream",
-			   "[GvStream::finalize] n_duplicated_packets   = %d", thread_data->n_duplicated_packets);
-		arv_debug ("stream",
-			   "[GvStream::finalize] n_missing_frames       = %d", thread_data->n_missing_frames);
+		arv_debug_stream ("[GvStream::finalize] n_completed_buffers    = %d",
+				  thread_data->n_completed_buffers);
+		arv_debug_stream ("[GvStream::finalize] n_failures             = %d",
+				  thread_data->n_failures);
+		arv_debug_stream ("[GvStream::finalize] n_timeouts             = %d",
+				  thread_data->n_timeouts);
+		arv_debug_stream ("[GvStream::finalize] n_aborteds             = %d",
+				  thread_data->n_aborteds);
+		arv_debug_stream ("[GvStream::finalize] n_underruns            = %d",
+				  thread_data->n_underruns);
+		arv_debug_stream ("[GvStream::finalize] n_size_mismatch_errors = %d",
+				  thread_data->n_size_mismatch_errors);
+		arv_debug_stream ("[GvStream::finalize] n_missing_packets      = %d",
+				  thread_data->n_missing_packets);
+		arv_debug_stream ("[GvStream::finalize] n_late_packets         = %d",
+				  thread_data->n_late_packets);
+		arv_debug_stream ("[GvStream::finalize] n_resend_requests      = %d",
+				  thread_data->n_resend_requests);
+		arv_debug_stream ("[GvStream::finalize] n_resent_packets       = %d",
+				  thread_data->n_resent_packets);
+		arv_debug_stream ("[GvStream::finalize] n_duplicated_packets   = %d",
+				  thread_data->n_duplicated_packets);
+		arv_debug_stream ("[GvStream::finalize] n_missing_frames       = %d",
+				  thread_data->n_missing_frames);
 
 		g_free (thread_data);
 
diff --git a/src/arvstream.c b/src/arvstream.c
index 5a4aa9e..77bb44b 100644
--- a/src/arvstream.c
+++ b/src/arvstream.c
@@ -292,12 +292,10 @@ arv_stream_finalize (GObject *object)
 	ArvStream *stream = ARV_STREAM (object);
 	ArvBuffer *buffer;
 
-	arv_debug ("stream",
-		   "[Stream::finalize] Flush %d buffer[s] in input queue",
-		   g_async_queue_length (stream->priv->input_queue));
-	arv_debug ("stream",
-		   "[Stream::finalize] Flush %d buffer[s] in output queue",
-		   g_async_queue_length (stream->priv->output_queue));
+	arv_debug_stream ("[Stream::finalize] Flush %d buffer[s] in input queue",
+			  g_async_queue_length (stream->priv->input_queue));
+	arv_debug_stream ("[Stream::finalize] Flush %d buffer[s] in output queue",
+			  g_async_queue_length (stream->priv->output_queue));
 
 	do {
 		buffer = g_async_queue_try_pop (stream->priv->output_queue);
diff --git a/src/arvsystem.c b/src/arvsystem.c
index f6d8824..28de1dc 100644
--- a/src/arvsystem.c
+++ b/src/arvsystem.c
@@ -135,4 +135,6 @@ arv_shutdown (void)
 
 	for (i = 0; i < G_N_ELEMENTS (interfaces); i++)
 		interfaces[i].destroy_interface_instance ();
+
+	arv_debug_shutdown ();
 }
diff --git a/src/arvtools.c b/src/arvtools.c
index 4ffe4dd..20ec8a5 100644
--- a/src/arvtools.c
+++ b/src/arvtools.c
@@ -682,8 +682,8 @@ arv_decompress (void *input_buffer, size_t input_size, size_t *output_size)
 		stream.avail_in = MIN (input_size, ARV_DECOMPRESS_CHUNK);
 		stream.next_in = input_buffer;
 
-		arv_debug ("decompress", "[Decompress] Input ptr = 0x%x - Chunk size = %d - %c",
-			   stream.next_in, stream.avail_in, *stream.next_in);
+		arv_debug_misc ("[Decompress] Input ptr = 0x%x - Chunk size = %d - %c",
+				stream.next_in, stream.avail_in, *stream.next_in);
 
 		input_size -= stream.avail_in;
 		input_buffer += stream.avail_in;
@@ -694,19 +694,19 @@ arv_decompress (void *input_buffer, size_t input_size, size_t *output_size)
 			stream.next_out = z_stream_output;
 			result = inflate(&stream, Z_NO_FLUSH);
 			if (result == Z_STREAM_ERROR) {
-				arv_debug ("decompress", "[Decompress] Z_STREAM_ERROR");
+				arv_warning_misc ("[Decompress] Z_STREAM_ERROR");
 				goto CLEANUP;
 			}
 
 			switch (result) {
 				case Z_NEED_DICT:
-					arv_debug ("decompress", "[Decompress] Z_NEED_DICT");
+					arv_warning_misc ("[Decompress] Z_NEED_DICT");
 					goto CLEANUP;
 				case Z_DATA_ERROR:
-					arv_debug ("decompress", "[Decompress] Z_DATA_ERROR");
+					arv_warning_misc ("[Decompress] Z_DATA_ERROR");
 					goto CLEANUP;
 				case Z_MEM_ERROR:
-					arv_debug ("decompress", "[Decompress] Z_MEM_ERROR");
+					arv_warning_misc ("[Decompress] Z_MEM_ERROR");
 					goto CLEANUP;
 			}
 
@@ -721,7 +721,7 @@ arv_decompress (void *input_buffer, size_t input_size, size_t *output_size)
 	inflateEnd(&stream);
 
 	if (result != Z_STREAM_END) {
-		arv_debug ("decompress", "[Decompress] !Z_STREAM_END");
+		arv_warning_misc ("[Decompress] !Z_STREAM_END");
 		g_byte_array_free (output, TRUE);
 		if (output_size != NULL)
 			*output_size = 0;
@@ -834,12 +834,12 @@ arv_pixel_format_to_gst_caps_string (ArvPixelFormat pixel_format)
 			break;
 
 	if (i == G_N_ELEMENTS (arv_gst_caps_infos)) {
-		arv_debug ("gst", "[PixelFormat::to_gst_caps_string] 0x%08x not found", pixel_format);
+		arv_warning_misc ("[PixelFormat::to_gst_caps_string] 0x%08x not found", pixel_format);
 		return NULL;
 	}
 
-	arv_debug ("gst", "[PixelFormat::to_gst_caps_string] 0x%08x -> %s",
-		   pixel_format, arv_gst_caps_infos[i].gst_caps_string);
+	arv_log_misc ("[PixelFormat::to_gst_caps_string] 0x%08x -> %s",
+		      pixel_format, arv_gst_caps_infos[i].gst_caps_string);
 
 	return arv_gst_caps_infos[i].gst_caps_string;
 }
diff --git a/src/arvzip.c b/src/arvzip.c
index 716f668..2c738c1 100644
--- a/src/arvzip.c
+++ b/src/arvzip.c
@@ -95,7 +95,7 @@ arv_zip_build_file_list (ArvZip *zip)
                 zip_file->offset = GUINT32_FROM_LE_PTR (ptr + 42);
 		zip_file->name = g_strndup ((char *) (ptr + 46), GUINT16_FROM_LE_PTR (ptr + 28));
 
-		arv_debug ("zip", "[Zip::list_files] %s", zip_file->name);
+		arv_debug_misc ("[Zip::list_files] %s", zip_file->name);
 
 		zip->files = g_slist_prepend (zip->files, zip_file);
 



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