Commit 1f0fc2e9 authored by winckel's avatar winckel

Added g_info to complete gmessages interface.

Change level of some log messages.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4502 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent a6e3e683
/*
* logs.h
*
* Created on: Nov 22, 2013
* Author: Laurent Winckel
*/
#ifndef LOGS_H_
#define LOGS_H_
/* Added definition of the g_info log function to complete the set of log functions from "gmessages.h" */
#include <glib/gmessages.h>
#ifdef G_HAVE_ISO_VARARGS
#define g_info(...) g_log (G_LOG_DOMAIN, \
G_LOG_LEVEL_INFO, \
__VA_ARGS__)
#else
static void
g_info (const gchar *format,
...)
{
va_list args;
va_start (args, format);
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format, args);
va_end (args);
}
#endif
#endif /* LOGS_H_ */
......@@ -102,7 +102,7 @@ int main(int argc, char *argv[])
* 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("PARSER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG))));
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));
......
......@@ -11,6 +11,7 @@
#include <gtk/gtk.h>
#include "logs.h"
#include "itti_types.h"
#include "rc.h"
......@@ -40,7 +41,7 @@ static ssize_t socket_read_data(socket_data_t *socket_data, void *buffer, size_t
case EAGAIN:
return -1;
default:
g_debug("recv failed: %s", g_strerror(errno));
g_info("recv failed: %s", g_strerror(errno));
pthread_exit(NULL);
break;
}
......@@ -193,8 +194,8 @@ static int socket_read(socket_data_t *socket_data)
break;
case ITTI_STATISTIC_MESSAGE_TYPE:
default:
g_debug("Received unknow (or not implemented) message from socket type: %d",
message_header.message_type);
g_warning("Received unknow (or not implemented) message from socket type: %d",
message_header.message_type);
break;
}
}
......@@ -250,7 +251,7 @@ static int pipe_read_message(socket_data_t *socket_data)
case UI_PIPE_DISCONNECT_EVT:
return socket_handle_disconnect_evt(socket_data);
default:
g_debug("[socket] Unhandled message type %u", input_header.message_type);
g_warning("[socket] Unhandled message type %u", input_header.message_type);
g_assert_not_reached();
}
return 0;
......@@ -275,7 +276,7 @@ void *socket_thread_fct(void *arg)
/* Preparing the socket */
if ((socket_data->sd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
g_debug("socket failed: %s", g_strerror(errno));
g_warning("socket failed: %s", g_strerror(errno));
free(socket_data->ip_address);
free(socket_data);
pthread_exit(NULL);
......@@ -285,7 +286,7 @@ void *socket_thread_fct(void *arg)
si_me.sin_family = AF_INET;
si_me.sin_port = htons(socket_data->port);
if (inet_aton(socket_data->ip_address, &si_me.sin_addr) == 0) {
g_debug("inet_aton() failed\n");
g_warning("inet_aton() failed\n");
free(socket_data->ip_address);
free(socket_data);
pthread_exit(NULL);
......@@ -313,7 +314,7 @@ void *socket_thread_fct(void *arg)
/* Connecting to remote peer */
ret = connect(socket_data->sd, (struct sockaddr *)&si_me, sizeof(struct sockaddr_in));
if (ret < 0) {
g_debug("Failed to connect to peer %s:%d",
g_warning("Failed to connect to peer %s:%d",
socket_data->ip_address, socket_data->port);
ui_pipe_write_message(socket_data->pipe_fd,
UI_PIPE_CONNECTION_FAILED, NULL, 0);
......@@ -331,7 +332,7 @@ void *socket_thread_fct(void *arg)
ret = select(fd_max + 1, &read_fds, NULL, NULL, &tv);
if (ret < 0) {
g_debug("Error in select: %s", g_strerror(errno));
g_warning("Error in select: %s", g_strerror(errno));
free(socket_data->ip_address);
free(socket_data);
/* Quit the thread */
......
......@@ -659,7 +659,7 @@ int xml_parse_buffer(const char *xml_buffer, const int size) {
doc = xmlReadMemory(xml_buffer, size, NULL, NULL, 0);
if (doc == NULL) {
g_debug("Failed to parse XML buffer: %s", xml_buffer);
g_warning("Failed to parse XML buffer: %s", xml_buffer);
ui_notification_dialog(GTK_MESSAGE_ERROR, "parse messages format definition", "Fail to parse XML buffer");
return RC_FAIL;
}
......
......@@ -9,6 +9,7 @@
#include <gtk/gtk.h>
#include "logs.h"
#include "rc.h"
#include "socket.h"
......@@ -62,7 +63,7 @@ gboolean ui_callback_on_filters_enabled(GtkToolButton *button, gpointer data)
enabled = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON(button));
g_debug("Filters enabled event occurred %d", enabled);
g_info("Filters enabled event occurred %d", enabled);
changed = ui_filters_enable (enabled);
......@@ -195,7 +196,7 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
ui_create_filter_menus ();
}
g_debug("Message selected right click %d %d %d %d", message_id, origin_task_id, destination_task_id, instance);
g_info("Message selected right click %d %d %d %d", message_id, origin_task_id, destination_task_id, instance);
/* Message Id menu */
{
......@@ -308,13 +309,13 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
data = (gchar *) buffer_at_offset ((buffer_t*) buffer, message_header_type_size);
data_size = get_message_size ((buffer_t*) buffer);
g_debug(" message header type size: %u, data size: %u %p %d", message_header_type_size, data_size, buffer, ui_main_data.follow_last);
g_info(" message header type size: %u, data size: %u %p %d", message_header_type_size, data_size, buffer, ui_main_data.follow_last);
ui_signal_set_text (text_view, data, data_size);
}
else
{
g_debug(" dissect message %d %p %d", message_id, buffer, ui_main_data.follow_last);
g_info(" dissect message %d %p %d", message_id, buffer, ui_main_data.follow_last);
/* Dissect the signal */
CHECK_FCT_DO(dissect_signal((buffer_t*)buffer, ui_signal_set_text, text_view), return FALSE);
......@@ -370,7 +371,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_debug("Selected color for %s %f->%02x %f->%02x %f->%02x %s",
g_info("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);
......@@ -664,7 +665,7 @@ gboolean ui_callback_on_menu_none(GtkWidget *widget, gpointer data)
{
GtkWidget *menu = (GtkWidget *) data;
g_debug("ui_callback_on_menu_none occurred %lx %lx)", (long) widget, (long) data);
g_info("ui_callback_on_menu_none occurred %lx %lx)", (long) widget, (long) data);
refresh_message_list = FALSE;
gtk_container_foreach (GTK_CONTAINER(menu), ui_callback_on_menu_items_selected, (gpointer) FALSE);
......@@ -683,7 +684,7 @@ gboolean ui_callback_on_menu_all(GtkWidget *widget, gpointer data)
{
GtkWidget *menu = (GtkWidget *) data;
g_debug("ui_callback_on_menu_all occurred %lx %lx)", (long) widget, (long) data);
g_info("ui_callback_on_menu_all occurred %lx %lx)", (long) widget, (long) data);
refresh_message_list = FALSE;
gtk_container_foreach (GTK_CONTAINER(menu), ui_callback_on_menu_items_selected, (gpointer) TRUE);
......@@ -716,7 +717,7 @@ gboolean ui_callback_on_menu_item_selected(GtkWidget *widget, gpointer data)
filters_changed = TRUE;
}
}
g_debug("ui_callback_on_menu_item_selected occurred %p %p %s %d (%d messages to display)", widget, data, filter_entry->name, enabled, ui_tree_view_get_filtered_number());
g_info("ui_callback_on_menu_item_selected occurred %p %p %s %d (%d messages to display)", widget, data, filter_entry->name, enabled, ui_tree_view_get_filtered_number());
return TRUE;
}
......@@ -725,7 +726,7 @@ gboolean ui_callback_on_tree_column_header_click(GtkWidget *widget, gpointer dat
{
col_type_t col = (col_type_t) data;
g_debug("ui_callback_on_tree_column_header_click %d", col);
g_info("ui_callback_on_tree_column_header_click %d", col);
switch (col)
{
case COL_MESSAGE:
......
......@@ -12,6 +12,7 @@
#include <gtk/gtk.h>
#include "logs.h"
#include "rc.h"
#include "ui_interface.h"
......@@ -122,7 +123,7 @@ void ui_gtk_parse_arg(int argc, char *argv[])
static int ui_idle_callback(gpointer data)
{
g_debug("Entering idle state");
g_info("Entering idle state");
gtk_window_set_focus (GTK_WINDOW(ui_main_data.window), ui_main_data.messages_list);
......
......@@ -5,6 +5,7 @@
#include <gtk/gtk.h>
#include "logs.h"
#include "rc.h"
#include "buffers.h"
......@@ -64,7 +65,7 @@ static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter,
static gboolean onButtonPressed(GtkWidget *treeview, GdkEventButton *event, gpointer userdata)
{
g_debug("onButtonPressed %p %p %p %d %d", treeview, event, userdata, event->type, event->button);
g_info("onButtonPressed %p %p %p %d %d", treeview, event, userdata, event->type, event->button);
ui_tree_view_last_event = event;
return FALSE;
......@@ -73,7 +74,7 @@ static gboolean onButtonPressed(GtkWidget *treeview, GdkEventButton *event, gpoi
/*
static gboolean onButtonRelease(GtkWidget *treeview, GdkEventButton *event, gpointer userdata)
{
g_debug("onButtonRelease %p %p %p %d %d", treeview, event, userdata, event->type, event->button);
g_info("onButtonRelease %p %p %p %d %d", treeview, event, userdata, event->type, event->button);
// last_event = event;
return FALSE;
......@@ -472,7 +473,7 @@ void ui_tree_view_refilter()
gtk_tree_model_foreach (GTK_TREE_MODEL(ui_store.store), updateColors, NULL);
}
g_debug("ui_tree_view_refilter: last message %d, %d messages displayed", ui_store.filtered_last_msg, ui_store.filtered_msg_number);
g_info("ui_tree_view_refilter: last message %d, %d messages displayed", ui_store.filtered_last_msg, ui_store.filtered_msg_number);
}
guint ui_tree_view_get_filtered_number(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment