elm using logging, please use new macros.
authorGustavo Sverzut Barbieri <barbieri@gmail.com>
Fri, 11 Sep 2009 14:21:58 +0000 (14:21 +0000)
committerGustavo Sverzut Barbieri <barbieri@gmail.com>
Fri, 11 Sep 2009 14:21:58 +0000 (14:21 +0000)
SVN revision: 42409

src/lib/elm_main.c
src/lib/elm_priv.h
src/lib/elm_win.c

index 8ce3954..7fc97b3 100644 (file)
@@ -264,6 +264,7 @@ static void _elm_rescale(void);
 char *_elm_appname = NULL;
 Elm_Config *_elm_config = NULL;
 const char *_elm_data_dir = NULL;
+int _elm_log_dom = -1;
 
 static Ecore_Event_Handler *_elm_exit_handler = NULL;
 static Ecore_Event_Handler *_elm_event_property_change = NULL;
@@ -354,6 +355,14 @@ elm_quicklaunch_init(int argc, char **argv)
    char buf[PATH_MAX];
    char *s;
 
+   eina_init();
+   _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
+   if (!_elm_log_dom)
+     {
+       EINA_LOG_ERR("could not register elementary log domain.");
+       _elm_log_dom = EINA_LOG_DOMAIN_GLOBAL;
+     }
+
    eet_init();
    ecore_init();
    ecore_app_args_set(argc, (const char **)argv);
@@ -564,7 +573,7 @@ elm_quicklaunch_sub_init(int argc, char **argv)
 
        if (!ecore_x_init(NULL))
          {
-            EINA_ERROR_PERR("elementary: ERROR. Cannot connect to X11 display. check $DISPLAY variable\n");
+            ERR("Cannot connect to X11 display. check $DISPLAY variable");
             exit(1);
          }
        if (!ecore_x_screen_is_composited(0))
@@ -638,6 +647,14 @@ elm_quicklaunch_shutdown(void)
    ecore_file_shutdown();
    ecore_shutdown();
    eet_shutdown();
+
+   if ((_elm_log_dom > -1) && (_elm_log_dom != EINA_LOG_DOMAIN_GLOBAL))
+     {
+       eina_log_domain_unregister(_elm_log_dom);
+       _elm_log_dom = -1;
+     }
+
+   eina_shutdown();
 }
 
 EAPI void
index 1e38aef..5b6f08b 100644 (file)
@@ -113,5 +113,12 @@ EAPI const char  *elm_widget_type_get(const Evas_Object *obj);
 extern char *_elm_appname;
 extern Elm_Config *_elm_config;
 extern const char *_elm_data_dir;
+extern int _elm_log_dom;
+
+#define CRITICAL(...) EINA_LOG_DOM_CRIT(_elm_log_dom, __VA_ARGS__)
+#define ERR(...) EINA_LOG_DOM_ERR(_elm_log_dom, __VA_ARGS__)
+#define WRN(...) EINA_LOG_DOM_WARN(_elm_log_dom, __VA_ARGS__)
+#define INF(...) EINA_LOG_DOM_INFO(_elm_log_dom, __VA_ARGS__)
+#define DBG(...) EINA_LOG_DOM_DBG(_elm_log_dom, __VA_ARGS__)
 
 #endif
index 69270d4..29bf8fb 100644 (file)
@@ -303,6 +303,8 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
    const Eina_List *l;
    const char *fontpath;
 
+   ERR("test");
+
    win = ELM_NEW(Elm_Win);
    switch (_elm_config->engine)
      {
@@ -332,7 +334,7 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
      }
    if (!win->ee)
      {
-       EINA_ERROR_PERR("elementary: ERROR. Cannot create window.\n");
+       ERR("Cannot create window.");
        free(win);
        return NULL;
      }