add logging for our sanity

SVN revision: 72300
This commit is contained in:
Gustavo Sverzut Barbieri 2012-06-17 16:32:23 +00:00
parent 98a197c4b2
commit fec0f1e071
4 changed files with 34 additions and 21 deletions

View File

@ -1,6 +1,4 @@
#ifdef HAVE_CONFIG_H #include "private.h"
#include "terminology_config.h"
#endif
#include <Ecore_Getopt.h> #include <Ecore_Getopt.h>
#include <Elementary.h> #include <Elementary.h>
@ -11,6 +9,8 @@
#include "options.h" #include "options.h"
#include "media.h" #include "media.h"
int _log_domain = -1;
static Evas_Object *win = NULL, *bg = NULL, *term = NULL, *media = NULL; static Evas_Object *win = NULL, *bg = NULL, *term = NULL, *media = NULL;
static Ecore_Timer *flush_timer = NULL; static Ecore_Timer *flush_timer = NULL;
@ -180,6 +180,15 @@ elm_main(int argc, char **argv)
int args, retval = EXIT_SUCCESS; int args, retval = EXIT_SUCCESS;
Evas_Object *o; Evas_Object *o;
_log_domain = eina_log_domain_register("terminology", NULL);
if (_log_domain < 0)
{
EINA_LOG_CRIT("could not create log domain 'terminology'.");
elm_shutdown();
return EXIT_FAILURE;
}
config_init(); config_init();
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR); elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
@ -189,7 +198,7 @@ elm_main(int argc, char **argv)
args = ecore_getopt_parse(&options, values, argc, argv); args = ecore_getopt_parse(&options, values, argc, argv);
if (args < 0) if (args < 0)
{ {
fputs("Could not parse command line options.\n", stderr); ERR("Could not parse command line options.");
retval = EXIT_FAILURE; retval = EXIT_FAILURE;
goto end; goto end;
} }
@ -276,6 +285,10 @@ elm_main(int argc, char **argv)
elm_run(); elm_run();
end: end:
config_shutdown(); config_shutdown();
eina_log_domain_unregister(_log_domain);
_log_domain = -1;
elm_shutdown(); elm_shutdown();
return retval; return retval;
} }

View File

@ -1,3 +1,5 @@
#include "private.h"
#include <Elementary.h> #include <Elementary.h>
#include <Emotion.h> #include <Emotion.h>
#include "media.h" #include "media.h"
@ -343,9 +345,9 @@ _cb_mov_progress(void *data, Evas_Object *obj, void *event)
{ {
Media *sd = evas_object_smart_data_get(data); Media *sd = evas_object_smart_data_get(data);
if (!sd) return; if (!sd) return;
printf("progress: '%s' '%3.3f\n", DBG("progress: '%s' '%3.3f",
emotion_object_progress_info_get(sd->o_img), emotion_object_progress_info_get(sd->o_img),
emotion_object_progress_status_get(sd->o_img)); emotion_object_progress_status_get(sd->o_img));
} }
static void static void
@ -353,9 +355,9 @@ _cb_mov_ref(void *data, Evas_Object *obj, void *event)
{ {
Media *sd = evas_object_smart_data_get(data); Media *sd = evas_object_smart_data_get(data);
if (!sd) return; if (!sd) return;
printf("ref: '%s' num '%i'\n", DBG("ref: '%s' num '%i'",
emotion_object_ref_file_get(sd->o_img), emotion_object_ref_file_get(sd->o_img),
emotion_object_ref_num_get(sd->o_img)); emotion_object_ref_num_get(sd->o_img));
} }
static void static void
@ -381,7 +383,7 @@ _type_mov_init(Evas_Object *obj)
mod = modules[config->vidmod]; mod = modules[config->vidmod];
if (!emotion_object_init(o, mod)) if (!emotion_object_init(o, mod))
{ {
printf("can't init emotion module '%s'\n", mod); ERR("can't init emotion module '%s'", mod);
evas_object_del(sd->o_img); evas_object_del(sd->o_img);
sd->o_img = NULL; sd->o_img = NULL;
return; return;

View File

@ -1,3 +1,11 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "terminology_config.h" #include "terminology_config.h"
#endif #endif
extern int _log_domain;
#define CRITICAL(...) EINA_LOG_DOM_CRIT(_log_domain, __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(_log_domain, __VA_ARGS__)
#define WRN(...) EINA_LOG_DOM_WARN(_log_domain, __VA_ARGS__)
#define INF(...) EINA_LOG_DOM_INFO(_log_domain, __VA_ARGS__)
#define DBG(...) EINA_LOG_DOM_DBG(_log_domain, __VA_ARGS__)

View File

@ -8,16 +8,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
///////////////////////////////////////////////////////////////////////////
//#define DBG(f, args...) printf(f, ##args)
#define DBG(f, args...) do {} while (0)
///////////////////////////////////////////////////////////////////////////
//#define INF(f, args...) printf("==INF: "f, ##args)
#define INF(f, args...) do {} while (0)
///////////////////////////////////////////////////////////////////////////
#define ERR(f, args...) printf("######ERR: "f, ##args)
//#define ERR(f, args...) do {} while (0)
static void static void
_text_clear(Termpty *ty, Termcell *cells, int count, int val, Eina_Bool inherit_att) _text_clear(Termpty *ty, Termcell *cells, int count, int val, Eina_Bool inherit_att)
{ {