diff --git a/common/utils/itti_analyzer/itti_analyzer.c b/common/utils/itti_analyzer/itti_analyzer.c index d82dd06399d9b7fbc8376fe7b7c3f3e90f0becda..9b54a667de83f49270fe8e09fdce5b2f6603ee06 100644 --- a/common/utils/itti_analyzer/itti_analyzer.c +++ b/common/utils/itti_analyzer/itti_analyzer.c @@ -15,18 +15,25 @@ #include "rc.h" +#define G_LOG_LEVELS (G_LOG_LEVEL_ERROR | \ + G_LOG_LEVEL_CRITICAL | \ + G_LOG_LEVEL_WARNING | \ + G_LOG_LEVEL_MESSAGE | \ + G_LOG_LEVEL_INFO | \ + G_LOG_LEVEL_DEBUG) + int debug_buffers = 1; int debug_parser = 0; -static void -console_log_handler(const char *log_domain, GLogLevelFlags log_level, - const char *message, gpointer user_data) +static void console_log_handler(const char *log_domain, GLogLevelFlags log_level, + const char *message, gpointer user_data) { + GLogLevelFlags domain_log_level = (GLogLevelFlags) user_data; time_t curr; struct tm *today; const char *level; - if (ui_main_data.log_flags & log_level) + if (ui_main_data.log_flags & domain_log_level & log_level) { switch (log_level & G_LOG_LEVEL_MASK) { @@ -59,7 +66,7 @@ console_log_handler(const char *log_domain, GLogLevelFlags log_level, time(&curr); today = localtime(&curr); - fprintf(stderr, "%02u:%02u:%02u %8s %s %s\n", today->tm_hour, today->tm_min, today->tm_sec, + fprintf(stderr, "%02u:%02u:%02u %-9s %s %s\n", today->tm_hour, today->tm_min, today->tm_sec, log_domain != NULL ? log_domain : "", level, message); } } @@ -76,9 +83,7 @@ int main(int argc, char *argv[]) G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | - G_LOG_LEVEL_DEBUG | - G_LOG_FLAG_FATAL | - G_LOG_FLAG_RECURSION); + G_LOG_LEVEL_DEBUG); /* This initialize the library and check potential ABI mismatches * between the version it was compiled for and the actual shared @@ -90,7 +95,20 @@ int main(int argc, char *argv[]) /* Initialize the widget set */ gtk_init(&argc, &argv); - g_log_set_handler(NULL, log_flags, console_log_handler, NULL); + /* Parse command line options */ + ui_gtk_parse_arg (argc, argv); + + /* Set log handlers: + * Domain, Levels, Handler, Domain enabled levels */ + g_log_set_handler( NULL, log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS)); + g_log_set_handler("BUFFERS", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG)))); + g_log_set_handler("PARSER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS)); + g_log_set_handler("RESOLVER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG)))); + g_log_set_handler("UI", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG)))); + g_log_set_handler("UI_CB", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS)); + g_log_set_handler("UI_FILTER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG)))); + g_log_set_handler("UI_INTER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS)); + g_log_set_handler("UI_TREE", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG)))); CHECK_FCT(ui_gtk_initialize(argc, argv)); diff --git a/common/utils/itti_analyzer/libbuffers/buffers.c b/common/utils/itti_analyzer/libbuffers/buffers.c index 22d5eba8ecbbb1e15981167c25aa37facdf11c23..d9f802f54b3dfa3686626cf825addcd977a4c0e2 100644 --- a/common/utils/itti_analyzer/libbuffers/buffers.c +++ b/common/utils/itti_analyzer/libbuffers/buffers.c @@ -3,6 +3,8 @@ #include <stdio.h> #include <string.h> +#define G_LOG_DOMAIN ("BUFFERS") + #include <glib.h> #include "rc.h" diff --git a/common/utils/itti_analyzer/libbuffers/file.c b/common/utils/itti_analyzer/libbuffers/file.c index 22cd865ecb1227434c4d879cce6a6e124ecad1af..2b530521a44ea9b6899305c07ef5bd8b61e2f405 100644 --- a/common/utils/itti_analyzer/libbuffers/file.c +++ b/common/utils/itti_analyzer/libbuffers/file.c @@ -5,6 +5,8 @@ #include <sys/stat.h> #include <fcntl.h> +#define G_LOG_DOMAIN ("BUFFERS") + #include <glib.h> #include "rc.h" diff --git a/common/utils/itti_analyzer/libbuffers/socket.c b/common/utils/itti_analyzer/libbuffers/socket.c index ff5e28fd3c0e1cb450c073563817f58c7bf10018..e9ca53f554b98bb6d2ce949181a994a570a5ae7b 100644 --- a/common/utils/itti_analyzer/libbuffers/socket.c +++ b/common/utils/itti_analyzer/libbuffers/socket.c @@ -7,6 +7,8 @@ #include <errno.h> #include <fcntl.h> +#define G_LOG_DOMAIN ("BUFFERS") + #include <gtk/gtk.h> #include "itti_types.h" diff --git a/common/utils/itti_analyzer/libparser/array_type.c b/common/utils/itti_analyzer/libparser/array_type.c index ebeb6b87d3cd3c581c0d71020e3d03660d027cf9..6379543f3db3123862560cc64d4936dafd3f36a3 100644 --- a/common/utils/itti_analyzer/libparser/array_type.c +++ b/common/utils/itti_analyzer/libparser/array_type.c @@ -4,6 +4,8 @@ #include <string.h> #include <ctype.h> +#define G_LOG_DOMAIN ("PARSER") + #include "array_type.h" #include "fundamental_type.h" #include "ui_interface.h" diff --git a/common/utils/itti_analyzer/libparser/enum_type.c b/common/utils/itti_analyzer/libparser/enum_type.c index 734cbac7a0ef86b8d65bedb0f425cd1ecd5b6747..35fef35b4f0ec2a60e24069969ed9b4e1ea4f5d6 100644 --- a/common/utils/itti_analyzer/libparser/enum_type.c +++ b/common/utils/itti_analyzer/libparser/enum_type.c @@ -3,6 +3,8 @@ #include <assert.h> #include <string.h> +#define G_LOG_DOMAIN ("PARSER") + #include "enum_type.h" #include "ui_interface.h" diff --git a/common/utils/itti_analyzer/libparser/enum_value_type.c b/common/utils/itti_analyzer/libparser/enum_value_type.c index 472fcb8064788313219a8faa379097eef2c40e7a..89e0f86e90dae0b1f3eb7d15c52bc37e4ea3a45b 100644 --- a/common/utils/itti_analyzer/libparser/enum_value_type.c +++ b/common/utils/itti_analyzer/libparser/enum_value_type.c @@ -3,6 +3,8 @@ #include <assert.h> #include <string.h> +#define G_LOG_DOMAIN ("PARSER") + #include "enum_value_type.h" #include "ui_interface.h" diff --git a/common/utils/itti_analyzer/libparser/field_type.c b/common/utils/itti_analyzer/libparser/field_type.c index c681e27af35eb6840d80786b44a6cd1ba23f0b6a..11b8a13942f05e47b4e97224bd9797c39e3e82c9 100644 --- a/common/utils/itti_analyzer/libparser/field_type.c +++ b/common/utils/itti_analyzer/libparser/field_type.c @@ -3,6 +3,8 @@ #include <assert.h> #include <string.h> +#define G_LOG_DOMAIN ("PARSER") + #include "rc.h" #include "field_type.h" diff --git a/common/utils/itti_analyzer/libparser/file_type.c b/common/utils/itti_analyzer/libparser/file_type.c index 0ca1bc3a655d6ed5079057e476ac2a744e0c5414..c63ab4946aa12ecbea846283024343e4827e452e 100644 --- a/common/utils/itti_analyzer/libparser/file_type.c +++ b/common/utils/itti_analyzer/libparser/file_type.c @@ -3,6 +3,8 @@ #include <assert.h> #include <string.h> +#define G_LOG_DOMAIN ("PARSER") + #include "file_type.h" int file_type_file_print(types_t *type, int indent, FILE *file) diff --git a/common/utils/itti_analyzer/libparser/fundamental_type.c b/common/utils/itti_analyzer/libparser/fundamental_type.c index 0ff786e58d52ac4fe017040fde0d9fc3232c034a..66117c9ec5426d8aae7517fb238765c6efb42f42 100644 --- a/common/utils/itti_analyzer/libparser/fundamental_type.c +++ b/common/utils/itti_analyzer/libparser/fundamental_type.c @@ -3,6 +3,8 @@ #include <string.h> #include <inttypes.h> +#define G_LOG_DOMAIN ("PARSER") + #include "fundamental_type.h" #include "ui_interface.h" diff --git a/common/utils/itti_analyzer/libparser/pointer_type.c b/common/utils/itti_analyzer/libparser/pointer_type.c index 39719c94949309d7f9e8ff90550c95b063464665..89de53312d79003183e79f4a90eabcc9c6518754 100644 --- a/common/utils/itti_analyzer/libparser/pointer_type.c +++ b/common/utils/itti_analyzer/libparser/pointer_type.c @@ -3,6 +3,8 @@ #include <assert.h> #include <string.h> +#define G_LOG_DOMAIN ("PARSER") + #include "pointer_type.h" #include "ui_interface.h" diff --git a/common/utils/itti_analyzer/libparser/reference_type.c b/common/utils/itti_analyzer/libparser/reference_type.c index 409428d624c8cd5f248948f17dda98b8ca216cee..e6d080e65603ffafad7e4e4969b6eacaab818b3f 100644 --- a/common/utils/itti_analyzer/libparser/reference_type.c +++ b/common/utils/itti_analyzer/libparser/reference_type.c @@ -3,6 +3,8 @@ #include <assert.h> #include <string.h> +#define G_LOG_DOMAIN ("PARSER") + #include "reference_type.h" #include "ui_interface.h" diff --git a/common/utils/itti_analyzer/libparser/struct_type.c b/common/utils/itti_analyzer/libparser/struct_type.c index a4189dc1c41f84d36b410920a09c5cc359b72bfb..5cf9e708a899f8950f315813826b6ff75854ef65 100644 --- a/common/utils/itti_analyzer/libparser/struct_type.c +++ b/common/utils/itti_analyzer/libparser/struct_type.c @@ -3,6 +3,8 @@ #include <assert.h> #include <string.h> +#define G_LOG_DOMAIN ("PARSER") + #include "rc.h" #include "struct_type.h" diff --git a/common/utils/itti_analyzer/libparser/typedef_type.c b/common/utils/itti_analyzer/libparser/typedef_type.c index 18239fc87bd89c95e9b2a477ee99d3e0af9eae85..41bd4152270389ea475befeec4bf2cf8b60453de 100644 --- a/common/utils/itti_analyzer/libparser/typedef_type.c +++ b/common/utils/itti_analyzer/libparser/typedef_type.c @@ -3,6 +3,8 @@ #include <assert.h> #include <string.h> +#define G_LOG_DOMAIN ("PARSER") + #include "typedef_type.h" #include "ui_interface.h" diff --git a/common/utils/itti_analyzer/libparser/types.c b/common/utils/itti_analyzer/libparser/types.c index 704ded8af73fd0412cb5229e982be4e9703abcf8..3248115ba325af13f3b0f8ca8a17324b589afb17 100644 --- a/common/utils/itti_analyzer/libparser/types.c +++ b/common/utils/itti_analyzer/libparser/types.c @@ -2,6 +2,8 @@ #include <stdlib.h> #include <string.h> +#define G_LOG_DOMAIN ("PARSER") + #include "types.h" #include "array_type.h" #include "enum_type.h" diff --git a/common/utils/itti_analyzer/libparser/union_type.c b/common/utils/itti_analyzer/libparser/union_type.c index df69290c0604895cb0911a715602bf84acb8e5ce..fc3fe091eef0906e8d0ffbef140c8b5c0d0def6c 100644 --- a/common/utils/itti_analyzer/libparser/union_type.c +++ b/common/utils/itti_analyzer/libparser/union_type.c @@ -3,6 +3,8 @@ #include <assert.h> #include <string.h> +#define G_LOG_DOMAIN ("PARSER") + #include "rc.h" #include "enum_value_type.h" diff --git a/common/utils/itti_analyzer/libparser/xml_parse.c b/common/utils/itti_analyzer/libparser/xml_parse.c index c5189e0be4fcf6360e19b8b95b6f9a37ec0f8829..8ec5cd4407f01dcef572ccbd6a44265a692b9c33 100644 --- a/common/utils/itti_analyzer/libparser/xml_parse.c +++ b/common/utils/itti_analyzer/libparser/xml_parse.c @@ -1,6 +1,8 @@ #include <string.h> #include <unistd.h> +#define G_LOG_DOMAIN ("PARSER") + #include <gtk/gtk.h> #include <libxml/parser.h> @@ -26,17 +28,6 @@ extern int debug_parser; # define INDENT_START 0 #endif -#define PARSER_DEBUG(fmt, args...) \ -do { \ - if (debug_parser) \ - g_debug("WARNING: "fmt, ##args); \ -} while(0) - -#define PARSER_ERROR(fmt, args...) \ -do { \ - g_error("FATAL: "fmt, ##args); \ -} while(0) - types_t *root = NULL; static int xml_parse_doc(xmlDocPtr doc); @@ -45,13 +36,13 @@ static int parse_attribute_name(xmlNode *node, types_t *type, int mandatory) { xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "name")) == NULL) { if (mandatory) { - PARSER_ERROR("cannot retrieve name attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_error("cannot retrieve name attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); return -1; } else { - PARSER_DEBUG("cannot retrieve name attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_warning("cannot retrieve name attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); return 0; } } @@ -62,8 +53,8 @@ static int parse_attribute_name(xmlNode *node, types_t *type, int mandatory) { static int parse_attribute_id(xmlNode *node, types_t *type) { xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "id")) == NULL) { - PARSER_ERROR("cannot retrieve id attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_error("cannot retrieve id attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); return -1; } type->id = atoi ((char *) &node_attribute->children->content[1]); @@ -74,14 +65,14 @@ static int parse_attribute_size(xmlNode *node, types_t *type, int mandatory) { xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "size")) == NULL) { if (mandatory) { - PARSER_ERROR("cannot retrieve size attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_error("cannot retrieve size attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->size = -1; return -1; } else { - PARSER_DEBUG("cannot retrieve size attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_warning("cannot retrieve size attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->size = -1; return 0; } @@ -94,14 +85,14 @@ static int parse_attribute_align(xmlNode *node, types_t *type, int mandatory) { xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "align")) == NULL) { if (mandatory) { - PARSER_ERROR("cannot retrieve align attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_error("cannot retrieve align attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->align = -1; return -1; } else { - PARSER_DEBUG("cannot retrieve align attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_warning("cannot retrieve align attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->align = -1; return 0; } @@ -134,8 +125,8 @@ static int parse_attribute_context(xmlNode *node, types_t *type, int mandatory) xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "context")) == NULL) { if (mandatory) { - PARSER_ERROR("cannot retrieve context attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_error("cannot retrieve context attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->context = -1; return -1; } @@ -151,8 +142,8 @@ static int parse_attribute_context(xmlNode *node, types_t *type, int mandatory) static int parse_attribute_artificial(xmlNode *node, types_t *type) { xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "artificial")) == NULL) { - PARSER_DEBUG("cannot retrieve artificial attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_warning("cannot retrieve artificial attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->artificial = -1; return 0; } @@ -163,8 +154,8 @@ static int parse_attribute_artificial(xmlNode *node, types_t *type) { static int parse_attribute_init(xmlNode *node, types_t *type) { xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "init")) == NULL) { - PARSER_ERROR("cannot retrieve init attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_error("cannot retrieve init attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->init_value = -1; return 0; } @@ -176,14 +167,14 @@ static int parse_attribute_members(xmlNode *node, types_t *type, int mandatory) xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "members")) == NULL) { if (mandatory) { - PARSER_ERROR("cannot retrieve members attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_error("cannot retrieve members attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->members = 0; return -1; } else { - PARSER_DEBUG("cannot retrieve members attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_warning("cannot retrieve members attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->members = 0; return 0; } @@ -196,14 +187,14 @@ static int parse_attribute_mangled(xmlNode *node, types_t *type, int mandatory) xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "mangled")) == NULL) { if (mandatory) { - PARSER_ERROR("cannot retrieve mangled attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_error("cannot retrieve mangled attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->mangled = 0; return -1; } else { - PARSER_DEBUG("cannot retrieve mangled attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_warning("cannot retrieve mangled attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->mangled = 0; return 0; } @@ -216,14 +207,14 @@ static int parse_attribute_demangled(xmlNode *node, types_t *type, int mandatory xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "mangled")) == NULL) { if (mandatory) { - PARSER_ERROR("cannot retrieve demangled attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_error("cannot retrieve demangled attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->demangled = 0; return -1; } else { - PARSER_DEBUG("cannot retrieve demangled attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_warning("cannot retrieve demangled attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->demangled = 0; return 0; } @@ -236,14 +227,14 @@ static int parse_attribute_offset(xmlNode *node, types_t *type, int mandatory) { xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "offset")) == NULL) { if (mandatory) { - PARSER_ERROR("cannot retrieve offset attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_error("cannot retrieve offset attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->offset = -1; return -1; } else { - PARSER_DEBUG("cannot retrieve offset attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_warning("cannot retrieve offset attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->offset = -1; return 0; } @@ -256,14 +247,14 @@ static int parse_attribute_bits(xmlNode *node, types_t *type, int mandatory) { xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "bits")) == NULL) { if (mandatory) { - PARSER_ERROR("cannot retrieve bits attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_error("cannot retrieve bits attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->bits = -1; return -1; } else { - PARSER_DEBUG("cannot retrieve bits attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_warning("cannot retrieve bits attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->bits = -1; return 0; } @@ -276,14 +267,14 @@ static int parse_attribute_type(xmlNode *node, types_t *type, int mandatory) { xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "type")) == NULL) { if (mandatory) { - PARSER_ERROR("cannot retrieve type attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_error("cannot retrieve type attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->type_xml = 0; return -1; } else { - PARSER_DEBUG("cannot retrieve type attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_warning("cannot retrieve type attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->type_xml = 0; return 0; } @@ -296,14 +287,14 @@ static int parse_attribute_min(xmlNode *node, types_t *type, int mandatory) { xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "min")) == NULL) { if (mandatory) { - PARSER_ERROR("cannot retrieve min attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_error("cannot retrieve min attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->min = 0; return -1; } else { - PARSER_DEBUG("cannot retrieve min attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_warning("cannot retrieve min attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->min = 0; return 0; } @@ -316,14 +307,14 @@ static int parse_attribute_max(xmlNode *node, types_t *type, int mandatory) { xmlAttrPtr node_attribute; if ((node_attribute = xmlHasProp (node, (xmlChar *) "max")) == NULL) { if (mandatory) { - PARSER_ERROR("cannot retrieve max attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_error("cannot retrieve max attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->max = 0; return -1; } else { - PARSER_DEBUG("cannot retrieve max attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); + g_warning("cannot retrieve max attribute in node %s, %s:%ld", + (char *)node->name, node->doc->URL, XML_GET_LINE(node)); type->max = 0; return 0; } @@ -663,7 +654,7 @@ int xml_parse_buffer(const char *xml_buffer, const int size) { return -1; } - g_message("Parsing XML definition from buffer ..."); + g_debug("Parsing XML definition from buffer ..."); doc = xmlReadMemory(xml_buffer, size, NULL, NULL, 0); diff --git a/common/utils/itti_analyzer/libresolver/locate_root.c b/common/utils/itti_analyzer/libresolver/locate_root.c index 25566db88656a34aa27474a56a03afdae4afb9ee..1d450c42819fb3d62d999ec30c6fa32caca4da67 100644 --- a/common/utils/itti_analyzer/libresolver/locate_root.c +++ b/common/utils/itti_analyzer/libresolver/locate_root.c @@ -1,6 +1,8 @@ #include <stdio.h> #include <string.h> +#define G_LOG_DOMAIN ("RESOLVER") + #include <glib.h> #include "rc.h" diff --git a/common/utils/itti_analyzer/libresolver/resolvers.c b/common/utils/itti_analyzer/libresolver/resolvers.c index 2925e5dd3cea4985bebcf019e1392235d3aac2ad..840d5ab2d09af7fb54b21cb957108cdbca06559b 100644 --- a/common/utils/itti_analyzer/libresolver/resolvers.c +++ b/common/utils/itti_analyzer/libresolver/resolvers.c @@ -2,6 +2,8 @@ #include <stdlib.h> #include <string.h> +#define G_LOG_DOMAIN ("RESOLVER") + #include <glib.h> #include "types.h" diff --git a/common/utils/itti_analyzer/libui/ui_callbacks.c b/common/utils/itti_analyzer/libui/ui_callbacks.c index fb155b460980d1c4bb98357f4be0cd1691614e6b..217431d34c593fc8168eb8829abb1c85c89fe0d3 100644 --- a/common/utils/itti_analyzer/libui/ui_callbacks.c +++ b/common/utils/itti_analyzer/libui/ui_callbacks.c @@ -5,6 +5,8 @@ #include <stdlib.h> #include <stdint.h> +#define G_LOG_DOMAIN ("UI_CB") + #include <gtk/gtk.h> #include "rc.h" @@ -368,7 +370,7 @@ gboolean ui_callback_on_menu_color(GtkWidget *widget, gpointer data) snprintf (color_string, COLOR_SIZE, "#%02x%02x%02x", red, green, blue); ui_tree_view_refilter (); - g_message("Selected color for %s %f->%02x %f->%02x %f->%02x %s", + g_debug("Selected color for %s %f->%02x %f->%02x %f->%02x %s", menu_color->menu_enable->filter_item->name, color.red, red, color.green, green, color.blue, blue, color_string); } gtk_widget_destroy (color_chooser); diff --git a/common/utils/itti_analyzer/libui/ui_filters.c b/common/utils/itti_analyzer/libui/ui_filters.c index f0771a43d2133762131dc29e4c10277ec7b2bd93..79537a78b05be9b67a0cd5e32ebf59ca8c393846 100644 --- a/common/utils/itti_analyzer/libui/ui_filters.c +++ b/common/utils/itti_analyzer/libui/ui_filters.c @@ -1,5 +1,8 @@ #include <stdio.h> #include <stdlib.h> + +#define G_LOG_DOMAIN ("UI_FILTER") + #include <glib.h> #include <libxml/parser.h> @@ -252,7 +255,7 @@ static ui_filter_e ui_filter_from_name(const char *name) return FILTER_UNKNOWN; } -static int xml_parse_filters(xmlDocPtr doc) +static int xml_parse_filters(xmlDocPtr doc, const char *file_name) { xmlNode *root_element = NULL; xmlNode *filter_node = NULL; @@ -354,8 +357,7 @@ static int xml_parse_filters(xmlDocPtr doc) ret = RC_OK; } - g_message( - "Parsed XML filters definition found %d entries (%d messages to display)", filters_entries, ui_tree_view_get_filtered_number()); + g_message("Parsed XML filters file \"%s\", found %d entries (%d messages to display)", file_name, filters_entries, ui_tree_view_get_filtered_number()); return ret; } @@ -378,7 +380,7 @@ int ui_filters_read(const char *file_name) return RC_FAIL; } - ret = xml_parse_filters (doc); + ret = xml_parse_filters (doc, file_name); if (ret != RC_OK) { ui_notification_dialog (GTK_MESSAGE_WARNING, "open filters", "Found no filter definitions in \"%s\"", diff --git a/common/utils/itti_analyzer/libui/ui_interface.c b/common/utils/itti_analyzer/libui/ui_interface.c index 5010a07658e3ab7f60a80a74ab0896a747167cfe..806dce8b6ca7750943609195428baabd175a2412 100644 --- a/common/utils/itti_analyzer/libui/ui_interface.c +++ b/common/utils/itti_analyzer/libui/ui_interface.c @@ -2,6 +2,8 @@ #include <stdint.h> #include <unistd.h> +#define G_LOG_DOMAIN ("UI_INTER") + #include <gtk/gtk.h> #include "ui_interface.h" diff --git a/common/utils/itti_analyzer/libui/ui_main_screen.c b/common/utils/itti_analyzer/libui/ui_main_screen.c index e89e6eba10c8cd0eb2eb0bb81be7ee842de8e2e6..e56a9ad84f89d3cca5a2102d40735c863542443b 100644 --- a/common/utils/itti_analyzer/libui/ui_main_screen.c +++ b/common/utils/itti_analyzer/libui/ui_main_screen.c @@ -8,6 +8,8 @@ #include <string.h> #include <unistd.h> +#define G_LOG_DOMAIN ("UI") + #include <gtk/gtk.h> #include "rc.h" @@ -22,11 +24,6 @@ ui_main_data_t ui_main_data; -gchar *LOG_DOMAIN_PARSE = "Parse"; -gchar *LOG_DOMAIN_PIPE = "Pipe"; -gchar *LOG_DOMAIN_SOCKET = "Socket"; -gchar *LOG_DOMAIN_UI = "UI"; - static void ui_help(void) { printf ("Usage: itti_analyser [options]\n\n" @@ -40,10 +37,20 @@ static void ui_help(void) " -p PORT set port to PORT\n"); } -static void ui_gtk_parse_arg(int argc, char *argv[]) +void ui_gtk_parse_arg(int argc, char *argv[]) { char c; + /* Clear of ui_main_data not needed */ + // memset (&ui_main_data, 0, sizeof(ui_main_data_t)); + + /* Set some default initialization value for the IP address */ + ui_main_data.ip_entry_init = "127.0.0.1"; + ui_main_data.port_entry_init = "10006"; + + /* Set default log level to at least warning level messages */ + ui_main_data.log_flags = (G_LOG_LEVEL_MASK & (~(G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG))); + while ((c = getopt (argc, argv, "d:f:hi:l:m:p:")) != -1) { switch (c) @@ -160,17 +167,6 @@ int ui_gtk_initialize(int argc, char *argv[]) { GtkWidget *vbox; - memset (&ui_main_data, 0, sizeof(ui_main_data_t)); - - /* Set some default initialization value for the IP address */ - ui_main_data.ip_entry_init = "127.0.0.1"; - ui_main_data.port_entry_init = "10007"; - - /* Set default log level to all but debug message */ - ui_main_data.log_flags = (G_LOG_LEVEL_MASK & (~G_LOG_LEVEL_DEBUG)); - - ui_gtk_parse_arg (argc, argv); - /* Create the main window */ ui_main_data.window = gtk_window_new (GTK_WINDOW_TOPLEVEL); ui_init_filters (TRUE, FALSE); diff --git a/common/utils/itti_analyzer/libui/ui_main_screen.h b/common/utils/itti_analyzer/libui/ui_main_screen.h index a3c90e8093557d26fe6c0268ed8fd166b7874e95..3e2f9b287489a47f943e9cabe5cb8c922d87786c 100644 --- a/common/utils/itti_analyzer/libui/ui_main_screen.h +++ b/common/utils/itti_analyzer/libui/ui_main_screen.h @@ -59,6 +59,8 @@ typedef struct { extern ui_main_data_t ui_main_data; +void ui_gtk_parse_arg(int argc, char *argv[]); + void ui_set_title(const char *fmt, ...); int ui_gtk_initialize(int argc, char *argv[]); diff --git a/common/utils/itti_analyzer/libui/ui_menu_bar.c b/common/utils/itti_analyzer/libui/ui_menu_bar.c index 3ff63e4b8618ffac818082b413aaa739aac4f918..32b30e11b355916f4b80b3eb92ac40b7ae06971b 100644 --- a/common/utils/itti_analyzer/libui/ui_menu_bar.c +++ b/common/utils/itti_analyzer/libui/ui_menu_bar.c @@ -1,3 +1,5 @@ +#define G_LOG_DOMAIN ("UI") + #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> diff --git a/common/utils/itti_analyzer/libui/ui_notebook.c b/common/utils/itti_analyzer/libui/ui_notebook.c index a35024ade8ea8cacfde4de92096cd45d338f06ac..8a293f7041e3904af3dce0c254b78a1d8138a27e 100644 --- a/common/utils/itti_analyzer/libui/ui_notebook.c +++ b/common/utils/itti_analyzer/libui/ui_notebook.c @@ -6,6 +6,8 @@ #include <stdint.h> #include <gtk/gtk.h> +#define G_LOG_DOMAIN ("UI") + #include "rc.h" #include "ui_notebook.h" diff --git a/common/utils/itti_analyzer/libui/ui_notif_dlg.c b/common/utils/itti_analyzer/libui/ui_notif_dlg.c index 42dc60a1582b1d700aaf928cb2bc3447cc2c04ab..0586dc7f46f3bc9347c6252602245bdd8ee19321 100644 --- a/common/utils/itti_analyzer/libui/ui_notif_dlg.c +++ b/common/utils/itti_analyzer/libui/ui_notif_dlg.c @@ -1,3 +1,5 @@ +#define G_LOG_DOMAIN ("UI") + #include "rc.h" #include "ui_notif_dlg.h" diff --git a/common/utils/itti_analyzer/libui/ui_notifications.c b/common/utils/itti_analyzer/libui/ui_notifications.c index 2e04360d6f81b1b2397ddd3a002c4c81179e18ef..dfa188a33f1fe8b75c826208fbfbdfd6f83ccea9 100644 --- a/common/utils/itti_analyzer/libui/ui_notifications.c +++ b/common/utils/itti_analyzer/libui/ui_notifications.c @@ -3,6 +3,8 @@ #include <stdint.h> #include <stdarg.h> +#define G_LOG_DOMAIN ("UI") + #include <sys/stat.h> #include <gtk/gtk.h> diff --git a/common/utils/itti_analyzer/libui/ui_signal_dissect_view.c b/common/utils/itti_analyzer/libui/ui_signal_dissect_view.c index 0dd5b86b73fb3b2ff854e21cb8061db148c05f07..e1a588b86b132516ccbffe27c78772422c9a8e05 100644 --- a/common/utils/itti_analyzer/libui/ui_signal_dissect_view.c +++ b/common/utils/itti_analyzer/libui/ui_signal_dissect_view.c @@ -1,5 +1,7 @@ #include <string.h> +#define G_LOG_DOMAIN ("UI") + #include <gtk/gtk.h> #include "rc.h" diff --git a/common/utils/itti_analyzer/libui/ui_tree_view.c b/common/utils/itti_analyzer/libui/ui_tree_view.c index 6fa02104157063fa03ca96155584600755e51635..77ee7d8a582dc6730e950a103e3b27937d5fc4d7 100644 --- a/common/utils/itti_analyzer/libui/ui_tree_view.c +++ b/common/utils/itti_analyzer/libui/ui_tree_view.c @@ -1,6 +1,8 @@ #include <stdlib.h> #include <stdint.h> +#define G_LOG_DOMAIN ("UI_TREE") + #include <gtk/gtk.h> #include "rc.h"