From fec0f1e07146050a165620e8b9403b4d28edb4c2 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Sun, 17 Jun 2012 16:32:23 +0000 Subject: [PATCH] add logging for our sanity SVN revision: 72300 --- src/bin/main.c | 21 +++++++++++++++++---- src/bin/media.c | 16 +++++++++------- src/bin/private.h | 8 ++++++++ src/bin/termpty.c | 10 ---------- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/src/bin/main.c b/src/bin/main.c index a194ff60..04933005 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -1,6 +1,4 @@ -#ifdef HAVE_CONFIG_H -#include "terminology_config.h" -#endif +#include "private.h" #include #include @@ -11,6 +9,8 @@ #include "options.h" #include "media.h" +int _log_domain = -1; + static Evas_Object *win = NULL, *bg = NULL, *term = NULL, *media = NULL; static Ecore_Timer *flush_timer = NULL; @@ -180,6 +180,15 @@ elm_main(int argc, char **argv) int args, retval = EXIT_SUCCESS; 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(); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); 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); if (args < 0) { - fputs("Could not parse command line options.\n", stderr); + ERR("Could not parse command line options."); retval = EXIT_FAILURE; goto end; } @@ -276,6 +285,10 @@ elm_main(int argc, char **argv) elm_run(); end: config_shutdown(); + + eina_log_domain_unregister(_log_domain); + _log_domain = -1; + elm_shutdown(); return retval; } diff --git a/src/bin/media.c b/src/bin/media.c index 13edd756..25e99b16 100644 --- a/src/bin/media.c +++ b/src/bin/media.c @@ -1,3 +1,5 @@ +#include "private.h" + #include #include #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); if (!sd) return; - printf("progress: '%s' '%3.3f\n", - emotion_object_progress_info_get(sd->o_img), - emotion_object_progress_status_get(sd->o_img)); + DBG("progress: '%s' '%3.3f", + emotion_object_progress_info_get(sd->o_img), + emotion_object_progress_status_get(sd->o_img)); } static void @@ -353,9 +355,9 @@ _cb_mov_ref(void *data, Evas_Object *obj, void *event) { Media *sd = evas_object_smart_data_get(data); if (!sd) return; - printf("ref: '%s' num '%i'\n", - emotion_object_ref_file_get(sd->o_img), - emotion_object_ref_num_get(sd->o_img)); + DBG("ref: '%s' num '%i'", + emotion_object_ref_file_get(sd->o_img), + emotion_object_ref_num_get(sd->o_img)); } static void @@ -381,7 +383,7 @@ _type_mov_init(Evas_Object *obj) mod = modules[config->vidmod]; 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); sd->o_img = NULL; return; diff --git a/src/bin/private.h b/src/bin/private.h index d9061302..c1b0ded2 100644 --- a/src/bin/private.h +++ b/src/bin/private.h @@ -1,3 +1,11 @@ #ifdef HAVE_CONFIG_H #include "terminology_config.h" #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__) diff --git a/src/bin/termpty.c b/src/bin/termpty.c index 15421881..b84de0cc 100644 --- a/src/bin/termpty.c +++ b/src/bin/termpty.c @@ -8,16 +8,6 @@ #include #include -/////////////////////////////////////////////////////////////////////////// -//#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 _text_clear(Termpty *ty, Termcell *cells, int count, int val, Eina_Bool inherit_att) {