ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/tools/edi.git/commit/?id=de9b02ae6ecd98557812c2af1b14c2f243ab112e

commit de9b02ae6ecd98557812c2af1b14c2f243ab112e
Author: Andy Williams <a...@andywilliams.me>
Date:   Sun Dec 21 23:32:14 2014 +0000

    Fix logging so the bin is not trying to access the private lib domain - 
fixes build issues
---
 src/bin/edi_main.c    | 24 ++++++++++++++++++++++++
 src/bin/edi_private.h | 12 ++++++------
 src/lib/edi.c         |  7 +++++--
 3 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/src/bin/edi_main.c b/src/bin/edi_main.c
index 1245b45..894879e 100644
--- a/src/bin/edi_main.c
+++ b/src/bin/edi_main.c
@@ -40,6 +40,7 @@ static Elm_Object_Item *_edi_selected_bottompanel;
 static Evas_Object *_edi_filepanel, *_edi_filepanel_icon;
 
 static Evas_Object *_edi_main_win, *_edi_new_popup, *_edi_goto_popup;
+int _edi_log_dom = -1;
 
 static void
 _edi_file_open_cb(const char *path, const char *type, Eina_Bool newwin)
@@ -740,6 +741,26 @@ edi_close()
    elm_exit();
 }
 
+static Eina_Bool
+_edi_log_init()
+{
+   _edi_log_dom = eina_log_domain_register("edi", EINA_COLOR_GREEN);
+   if (_edi_log_dom < 0)
+     {
+        EINA_LOG_ERR("Edi can not create its log domain.");
+        return EINA_FALSE;
+     }
+
+   return EINA_TRUE;
+}
+
+static void
+_edi_log_shutdown()
+{
+   eina_log_domain_unregister(_edi_log_dom);
+   _edi_log_dom = -1;
+}
+
 static const Ecore_Getopt optdesc = {
   "edi",
   "%prog [options] [project-dir]",
@@ -784,6 +805,8 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
      goto config_error;
 
    edi_init();
+   if (!_edi_log_init())
+     goto end;
 
    args = ecore_getopt_parse(&optdesc, values, argc, argv);
    if (args < 0)
@@ -814,6 +837,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
    elm_run();
 
  end:
+   _edi_log_shutdown();
    elm_shutdown();
    edi_shutdown();
 
diff --git a/src/bin/edi_private.h b/src/bin/edi_private.h
index 0cbe1f3..43f2a4c 100644
--- a/src/bin/edi_private.h
+++ b/src/bin/edi_private.h
@@ -3,28 +3,28 @@
 
 #include <Evas.h>
 
-extern int _edi_lib_log_dom;
+extern int _edi_log_dom;
 
 #ifdef CRIT
 # undef CRIT
 #endif
-#define CRIT(...) EINA_LOG_DOM_CRIT(_edi_lib_log_dom, __VA_ARGS__)
+#define CRIT(...) EINA_LOG_DOM_CRIT(_edi_log_dom, __VA_ARGS__)
 #ifdef ERR
 # undef ERR
 #endif
-#define ERR(...) EINA_LOG_DOM_ERR(_edi_lib_log_dom, __VA_ARGS__)
+#define ERR(...) EINA_LOG_DOM_ERR(_edi_log_dom, __VA_ARGS__)
 #ifdef WRN
 # undef WRN
 #endif
-#define WRN(...) EINA_LOG_DOM_WARN(_edi_lib_log_dom, __VA_ARGS__)
+#define WRN(...) EINA_LOG_DOM_WARN(_edi_log_dom, __VA_ARGS__)
 #ifdef INF
 # undef INF
 #endif
-#define INF(...) EINA_LOG_DOM_INFO(_edi_lib_log_dom, __VA_ARGS__)
+#define INF(...) EINA_LOG_DOM_INFO(_edi_log_dom, __VA_ARGS__)
 #ifdef DBG
 # undef DBG
 #endif
-#define DBG(...) EINA_LOG_DOM_DBG(_edi_lib_log_dom, __VA_ARGS__)
+#define DBG(...) EINA_LOG_DOM_DBG(_edi_log_dom, __VA_ARGS__)
 
 #define EDI_CONTENT_AUTOSAVE EINA_TRUE
 
diff --git a/src/lib/edi.c b/src/lib/edi.c
index 3c4aec4..768a07f 100644
--- a/src/lib/edi.c
+++ b/src/lib/edi.c
@@ -22,12 +22,13 @@ edi_init(void)
 
    eina_init();
 
-   _edi_lib_log_dom = eina_log_domain_register("edi", EINA_COLOR_CYAN);
+   _edi_lib_log_dom = eina_log_domain_register("edi-lib", EINA_COLOR_CYAN);
    if (_edi_lib_log_dom < 0)
      {
-        EINA_LOG_ERR("Edi can not create its log domain.");
+        EINA_LOG_ERR("Edi lib cannot create its log domain.");
         goto shutdown_eina;
      }
+   INF("Edi library loaded");
 
    // Put here your initialization logic of your library
 
@@ -52,6 +53,8 @@ edi_shutdown(void)
                    EINA_LOG_STATE_START,
                    EINA_LOG_STATE_SHUTDOWN);
 
+   INF("Edi library shut down");
+
    // Put here your shutdown logic
 
    eina_log_domain_unregister(_edi_lib_log_dom);

-- 


Reply via email to