* ecore: Use eina_log.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 21 Dec 2009 17:32:19 +0000 (17:32 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 21 Dec 2009 17:32:19 +0000 (17:32 +0000)
Patch from Mathieu Taillefumier.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@44637 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

50 files changed:
src/bin/ecore_config.c
src/lib/ecore/ecore.c
src/lib/ecore/ecore_exe.c
src/lib/ecore/ecore_glib.c
src/lib/ecore/ecore_hash.c
src/lib/ecore/ecore_main.c
src/lib/ecore/ecore_pipe.c
src/lib/ecore/ecore_private.h
src/lib/ecore/ecore_signal.c
src/lib/ecore/ecore_timer.c
src/lib/ecore/ecore_value.c
src/lib/ecore_con/ecore_con.c
src/lib/ecore_con/ecore_con_private.h
src/lib/ecore_con/ecore_con_url.c
src/lib/ecore_config/ecore_config.c
src/lib/ecore_config/ecore_config_db.c
src/lib/ecore_config/ecore_config_extra.c
src/lib/ecore_config/ecore_config_ipc_ecore.c
src/lib/ecore_config/ecore_config_ipc_main.c
src/lib/ecore_config/ecore_config_private.h
src/lib/ecore_config/ecore_config_storage.c
src/lib/ecore_directfb/ecore_directfb.c
src/lib/ecore_directfb/ecore_directfb_private.h
src/lib/ecore_evas/ecore_evas.c
src/lib/ecore_evas/ecore_evas_private.h
src/lib/ecore_file/ecore_file.c
src/lib/ecore_file/ecore_file_monitor_inotify.c
src/lib/ecore_file/ecore_file_private.h
src/lib/ecore_imf/ecore_imf.c
src/lib/ecore_imf/ecore_imf_module.c
src/lib/ecore_imf/ecore_imf_private.h
src/lib/ecore_input/ecore_input.c
src/lib/ecore_ipc/ecore_ipc.c
src/lib/ecore_ipc/ecore_ipc_private.h
src/lib/ecore_job/ecore_job.c
src/lib/ecore_job/ecore_job_private.h
src/lib/ecore_sdl/ecore_sdl.c
src/lib/ecore_txt/ecore_txt_private.h
src/lib/ecore_win32/ecore_win32.c
src/lib/ecore_wince/ecore_wince.c
src/lib/ecore_x/xcb/ecore_xcb.c
src/lib/ecore_x/xcb/ecore_xcb_events.c
src/lib/ecore_x/xcb/ecore_xcb_icccm.c
src/lib/ecore_x/xcb/ecore_xcb_netwm.c
src/lib/ecore_x/xcb/ecore_xcb_private.h
src/lib/ecore_x/xlib/ecore_x.c
src/lib/ecore_x/xlib/ecore_x_events.c
src/lib/ecore_x/xlib/ecore_x_netwm.c
src/lib/ecore_x/xlib/ecore_x_private.h
src/lib/ecore_x/xlib/ecore_x_randr.c

index e3ef78c..243f31f 100644 (file)
@@ -62,7 +62,7 @@ get(const char *key)
 
    if (!(e = ecore_config_get(key)))
      {
-       fprintf(stderr, "No such property\n");
+       EINA_LOG_ERR("No such property");
        return -1;
      }
      
@@ -92,7 +92,7 @@ get(const char *key)
           temp = ecore_config_theme_get(key);
           break;
        default:
-          fprintf(stderr, "Property has unrecognized type");
+          EINA_LOG_ERR("Property has unrecognized type");
           return -1;
      }
    if(temp)
@@ -175,7 +175,7 @@ main(int argc, char * const argv[])
    float f;
    
    file = key = prog = NULL;
-
+   eina_init();
    prog = strdup(argv[0]);
 
    if(argc < 4)
@@ -275,7 +275,7 @@ main(int argc, char * const argv[])
    
    if(ecore_config_init("econfig") != ECORE_CONFIG_ERR_SUCC)
      {
-       fprintf(stderr, "Couldn't init ecore_config!");
+       EINA_LOG_ERR("Couldn't init ecore_config!");
        return 1;
      }
 
@@ -313,7 +313,7 @@ main(int argc, char * const argv[])
           if (list(file)) ret = 1;
           break;
        default:
-          printf("Unhandled command '%c'\n", cmd);
+          EINA_LOG_ERR("Unhandled command '%c'", cmd);
      }
 
    ecore_config_shutdown();
@@ -323,7 +323,7 @@ main(int argc, char * const argv[])
 
    if(file)
      free(file);
-
+   eina_shutdown();
    return ret;
 }
 #else
index cd648e6..ff00ff4 100644 (file)
@@ -34,7 +34,7 @@
 
 static const char *_ecore_magic_string_get(Ecore_Magic m);
 static int _ecore_init_count = 0;
-
+EAPI int _ecore_log_dom = -1;
 int _ecore_fps_debug = 0;
 
 /** OpenBSD does not define CODESET
@@ -79,7 +79,7 @@ ecore_init(void)
    /*
      if (strcmp(nl_langinfo(CODESET), "UTF-8"))
      {
-       printf("WARNING: not a utf8 locale!\n");
+       WRN("Not a utf8 locale!");
      }
    */
 #ifdef HAVE_EVIL
@@ -88,6 +88,11 @@ ecore_init(void)
 #endif
    if (!eina_init())
      goto shutdown_evil;
+   _ecore_log_dom = eina_log_domain_register("Ecore",ECORE_DEFAULT_LOG_COLOR);
+   if (_ecore_log_dom < 0) {
+     EINA_LOG_ERR("Ecore was unable to create a log domain.");
+     goto shutdown_log_dom;
+   }
    if (getenv("ECORE_FPS_DEBUG")) _ecore_fps_debug = 1;
    if (_ecore_fps_debug) _ecore_fps_debug_init();
    _ecore_signal_init();
@@ -98,6 +103,8 @@ ecore_init(void)
 
    return _ecore_init_count;
 
+ shutdown_log_dom: 
+   eina_shutdown();
  shutdown_evil:
 #ifdef HAVE_EVIL
    evil_shutdown();
@@ -134,6 +141,8 @@ ecore_shutdown(void)
    _ecore_event_shutdown();
    _ecore_main_shutdown();
    _ecore_signal_shutdown();
+   eina_log_domain_unregister(_ecore_log_dom);
+   _ecore_log_dom = -1;
    eina_shutdown();
 #ifdef HAVE_EVIL
    evil_shutdown();
@@ -145,25 +154,22 @@ ecore_shutdown(void)
 EAPI void
 _ecore_magic_fail(const void *d, Ecore_Magic m, Ecore_Magic req_m, const char *fname)
 {
-   fprintf(stderr,
-          "\n"
-          "*** ECORE ERROR: Ecore Magic Check Failed!!!\n"
-          "*** IN FUNCTION: %s()\n", fname);
+   ERR("\n"
+       "*** ECORE ERROR: Ecore Magic Check Failed!!!\n"
+       "*** IN FUNCTION: %s()", fname);
    if (!d)
-     fprintf(stderr, "  Input handle pointer is NULL!\n");
+     ERR("  Input handle pointer is NULL!");
    else if (m == ECORE_MAGIC_NONE)
-     fprintf(stderr, "  Input handle has already been freed!\n");
+     ERR("  Input handle has already been freed!");
    else if (m != req_m)
-     fprintf(stderr, "  Input handle is wrong type\n"
-                    "    Expected: %08x - %s\n"
-                    "    Supplied: %08x - %s\n",
-            (unsigned int)req_m, _ecore_magic_string_get(req_m),
-            (unsigned int)m, _ecore_magic_string_get(m));
-   fprintf(stderr,
-          "*** NAUGHTY PROGRAMMER!!!\n"
-          "*** SPANK SPANK SPANK!!!\n"
-          "*** Now go fix your code. Tut tut tut!\n"
-          "\n");
+     ERR("  Input handle is wrong type\n"
+        "    Expected: %08x - %s\n"
+        "    Supplied: %08x - %s",
+        (unsigned int)req_m, _ecore_magic_string_get(req_m),
+        (unsigned int)m, _ecore_magic_string_get(m));
+     ERR("*** NAUGHTY PROGRAMMER!!!\n"
+        "*** SPANK SPANK SPANK!!!\n"
+        "*** Now go fix your code. Tut tut tut!");
    if (getenv("ECORE_ERROR_ABORT")) abort();
 }
 
index cc29e4c..8c0f07d 100644 (file)
@@ -160,7 +160,7 @@ _ecore_exe_check_errno(int result, const char *file, int line)
          case EAGAIN:
          case EINTR:
             {                  /* Not now, try later. */
-               fprintf(stderr, "*** Must try again in %s @%u.\n", file, line);
+               ERR("*** Must try again in %s @%u.", file, line);
                result = -1;
                break;
             }
@@ -169,15 +169,15 @@ _ecore_exe_check_errno(int result, const char *file, int line)
          case ENFILE:
          case ENOLCK:
             {                  /* Low on resources. */
-               fprintf(stderr, "*** Low on resources in %s @%u.\n", file,
-                       line);
+               ERR("*** Low on resources in %s @%u.", file,
+                   line);
                result = 0;
                break;
             }
 
          case EIO:
             {                  /* I/O error. */
-               fprintf(stderr, "*** I/O error in %s @%u.\n", file, line);
+               ERR("*** I/O error in %s @%u.", file, line);
                result = 0;
                break;
             }
@@ -191,24 +191,22 @@ _ecore_exe_check_errno(int result, const char *file, int line)
          case EPERM:
          case EBUSY:
             {                  /* Programmer fucked up. */
-               fprintf(stderr,
-                       "*** NAUGHTY PROGRAMMER!!!\n"
-                       "*** SPANK SPANK SPANK!!!\n"
-                       "*** Now go fix your code in %s @%u. Tut tut tut!\n"
-                       "\n", file, line);
+              ERR("*** NAUGHTY PROGRAMMER!!!\n"
+                  "*** SPANK SPANK SPANK!!!\n"
+                  "*** Now go fix your code in %s @%u. Tut tut tut!",
+                  file, line);
                result = 0;
                break;
             }
 
          default:
             {                  /* Unsupported errno code, please add this one. */
-               fprintf(stderr,
-                       "*** NAUGHTY PROGRAMMER!!!\n"
-                       "*** SPANK SPANK SPANK!!!\n"
-                       "*** Unsupported errno code %d, please add this one.\n"
-                       "*** Now go fix your code in %s @%u, from %s @%u. Tut tut tut!\n"
-                       "\n", saved_errno, __FILE__, __LINE__, file, line);
-               result = 0;
+              ERR("*** NAUGHTY PROGRAMMER!!!\n"
+                  "*** SPANK SPANK SPANK!!!\n"
+                  "*** Unsupported errno code %d, please add this one.\n"
+                  "*** Now go fix your code in %s @%u, from %s @%u. Tut tut tut!",
+                  saved_errno, __FILE__, __LINE__, file, line);
+              result = 0;
                break;
             }
          }
@@ -400,7 +398,7 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
 
        if (pid == -1)
          {
-            fprintf(stderr, "Failed to fork process\n");
+            ERR("Failed to fork process");
             pid = 0;
          }
        else if (pid == 0)      /* child */
@@ -489,8 +487,8 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
                       if (vfork_exec_errno != 0)
                         {
                            n = vfork_exec_errno;
-                           fprintf(stderr, "Could not start \"%s\"\n",
-                                   exe_cmd);
+                           ERR("Could not start \"%s\"",
+                               exe_cmd);
                            pid = 0;
                         }
                       break;
@@ -604,7 +602,7 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
        if (e) /* Send the event. */
          ecore_event_add(ECORE_EXE_EVENT_ADD, e,
                          _ecore_exe_event_add_free, NULL);
-       /* printf("Running as %d for %s.\n", exe->pid, exe->cmd); */
+       /* INF("Running as %d for %s.\n", exe->pid, exe->cmd); */
      }
 
    errno = n;
@@ -1115,7 +1113,7 @@ ecore_exe_terminate(Ecore_Exe *exe)
        return;
      }
    _ecore_exe_dead_attach(exe);
-   printf("Sending TERM signal to %s (%d).\n", exe->cmd, exe->pid);
+   INF("Sending TERM signal to %s (%d).", exe->cmd, exe->pid);
    kill(exe->pid, SIGTERM);
 }
 
@@ -1145,7 +1143,7 @@ ecore_exe_kill(Ecore_Exe *exe)
           ecore_timer_add(10.0, _ecore_exe_make_sure_its_really_dead, dead);
      }
 
-   printf("Sending KILL signal to %s (%d).\n", exe->cmd, exe->pid);
+   INF("Sending KILL signal to %s (%d).", exe->cmd, exe->pid);
    kill(exe->pid, SIGKILL);
 }
 
@@ -1236,11 +1234,11 @@ _ecore_exe_make_sure_its_dead(void *data)
        if ((exe = _ecore_exe_is_it_alive(dead->pid)) != NULL)
          {
             if (dead->cmd)
-               printf("Sending KILL signal to alledgedly dead %s (%d).\n",
+               INF("Sending KILL signal to alledgedly dead %s (%d).",
                       dead->cmd, dead->pid);
             else
-               printf("Sending KILL signal to alledgedly dead PID %d.\n",
-                      dead->pid);
+               INF("Sending KILL signal to alledgedly dead PID %d.",
+                   dead->pid);
             exe->doomsday_clock =
                ecore_timer_add(10.0, _ecore_exe_make_sure_its_really_dead,
                                dead);
@@ -1267,12 +1265,11 @@ _ecore_exe_make_sure_its_really_dead(void *data)
 
        if ((exe = _ecore_exe_is_it_alive(dead->pid)) != NULL)
          {
-            printf
-               ("RUN!  The zombie wants to eat your brains!  And your CPU!\n");
+            ERR("RUN!  The zombie wants to eat your brains!  And your CPU!");
             if (dead->cmd)
-               printf("%s (%d) is not really dead.\n", dead->cmd, dead->pid);
+               INF("%s (%d) is not really dead.", dead->cmd, dead->pid);
             else
-               printf("PID %d is not really dead.\n", dead->pid);
+               INF("PID %d is not really dead.", dead->pid);
             exe->doomsday_clock = NULL;
          }
        IF_FREE(dead->cmd);
@@ -1508,15 +1505,13 @@ _ecore_exe_data_generic_handler(void *data, Ecore_Fd_Handler *fd_handler,
                       if (flags & ECORE_EXE_PIPE_READ)
                         {
                            if (exe->read_data_size)
-                              printf
-                                 ("There are %d bytes left unsent from the dead exe %s.\n",
+                              INF("There are %d bytes left unsent from the dead exe %s.",
                                   exe->read_data_size, exe->cmd);
                         }
                       else
                         {
                            if (exe->error_data_size)
-                              printf
-                                 ("There are %d bytes left unsent from the dead exe %s.\n",
+                              INF("There are %d bytes left unsent from the dead exe %s.",
                                   exe->error_data_size, exe->cmd);
                         }
                       /* Thought about this a bit.  If the exe has actually
@@ -1569,7 +1564,7 @@ _ecore_exe_data_write_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED_
        int ok = 0;
        int result;
 
-       printf("Closing stdin for %s\n", exe->cmd);
+       INF("Closing stdin for %s", exe->cmd);
        /* if (exe->child_fd_write != -1)  E_NO_ERRNO(result, fsync(exe->child_fd_write), ok);   This a) doesn't work, and b) isn't needed. */
        IF_FN_DEL(ecore_main_fd_handler_del, exe->write_fd_handler);
        if (exe->child_fd_write != -1)
index f279421..c635a82 100644 (file)
@@ -12,6 +12,7 @@
 
 #ifdef HAVE_GLIB
 #include <glib.h>
+#include "ecore_private.h"
 
 static Eina_Bool _ecore_glib_active = EINA_FALSE;
 static int (*_ecore_glib_select_original)(int, fd_set*, fd_set*, fd_set*, struct timeval *);
@@ -28,8 +29,8 @@ _ecore_glib_fds_resize(size_t size)
    void *tmp = realloc(_ecore_glib_fds, sizeof(GPollFD) * size);
    if (!tmp)
      {
-       fprintf(stderr, "ERROR: Could not realloc from %zu to %zu buckets.\n",
-               _ecore_glib_fds_size, size);
+       ERR("Could not realloc from %zu to %zu buckets.",
+           _ecore_glib_fds_size, size);
        return EINA_FALSE;
      }
 
index 90e0cba..4f1050f 100644 (file)
@@ -366,10 +366,10 @@ ecore_hash_dump_graph(Ecore_Hash *hash)
          Ecore_Hash_Node *node;
          for (node = hash->buckets[i]; node; node = node->next)
            n++;
-         printf("%d\t%u\n", i, n);
+         INF("%d\t%u", i, n);
        }
    else
-     printf("%d\t0\n", i);
+     INF("%d\t0", i);
 }
 
 /**
@@ -395,7 +395,7 @@ ecore_hash_dump_stats(Ecore_Hash *hash)
          }
      }
    variance = (sum_n_2 - ((sum_n * sum_n) / (double)i)) / (double)i;
-   printf("Average length: %f\n\tvariance^2: %f\n", (sum_n / (double)i),
+   INF("Average length: %f\n\tvariance^2: %f", (sum_n / (double)i),
                   variance);
 }
 
index 502b9f0..0a3205a 100644 (file)
@@ -379,10 +379,9 @@ _ecore_main_shutdown(void)
 {
    if (in_main_loop)
      {
-       fprintf(stderr,
-               "\n"
-               "*** ECORE WARINING: Calling ecore_shutdown() while still in the main loop.\n"
-               "***                 Program may crash or behave strangely now.\n");
+       ERR("\n"
+          "*** ECORE WARINING: Calling ecore_shutdown() while still in the main loop.\n"
+          "***                 Program may crash or behave strangely now.");
        return;
      }
    while (fd_handlers)
@@ -510,7 +509,7 @@ _ecore_main_select(double timeout)
 static void
 _ecore_main_fd_handlers_bads_rem(void)
 {
-   fprintf(stderr, "Removing bad fds\n");
+   ERR("Removing bad fds");
    Ecore_Fd_Handler *fdh;
    Eina_Inlist *l;
 
@@ -522,20 +521,20 @@ _ecore_main_fd_handlers_bads_rem(void)
 
        if ((fcntl(fdh->fd, F_GETFD) < 0) && (errno == EBADF))
          {
-            fprintf(stderr, "Found bad fd at index %d\n", fdh->fd);
+            ERR("Found bad fd at index %d", fdh->fd);
             if (fdh->flags & ECORE_FD_ERROR)
               {
-                 fprintf(stderr, "Fd set for error! calling user\n");
+                 ERR("Fd set for error! calling user");
                 if (!fdh->func(fdh->data, fdh))
                   {
-                    fprintf(stderr, "Fd function err returned 0, remove it\n");
+                    ERR("Fd function err returned 0, remove it");
                     fdh->delete_me = 1;
                     fd_handlers_delete_me = 1;
                   }
               }
             else
               {
-                 fprintf(stderr, "Problematic fd found at %d! setting it for delete\n", fdh->fd);
+                 ERR("Problematic fd found at %d! setting it for delete", fdh->fd);
                  fdh->delete_me = 1;
                  fd_handlers_delete_me = 1;
               }
@@ -560,7 +559,7 @@ _ecore_main_fd_handlers_cleanup(void)
        l = l->next;
        if (fdh->delete_me)
          {
-//          fprintf(stderr, "Removing fd %d\n", fdh->fd);
+//          ERR("Removing fd %d", fdh->fd);
             fd_handlers = (Ecore_Fd_Handler *) eina_inlist_remove(EINA_INLIST_GET(fd_handlers),
                                                                   EINA_INLIST_GET(fdh));
             ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
@@ -878,13 +877,13 @@ _ecore_main_win32_select(int nfds, fd_set *readfds, fd_set *writefds,
         char *msg;
 
         msg = evil_last_error_get();
-        printf (" * %s\n", msg);
+        ERR(" * %s\n", msg);
         free(msg);
         res = -1;
      }
    else if (result == WAIT_TIMEOUT)
      {
-        printf ("time out\n");
+        ERR("time out\n");
         res = 0;
      }
    else if (result == (WAIT_OBJECT_0 + objects_nbr))
@@ -928,7 +927,7 @@ _ecore_main_win32_select(int nfds, fd_set *readfds, fd_set *writefds,
      }
    else
      {
-        fprintf(stderr, "unknown result...\n");
+        ERR(stderr, "unknown result...\n");
         res = -1;
      }
 
index 149d6f8..6c52731 100644 (file)
@@ -415,8 +415,8 @@ ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes)
        else if (ret > 0)
          {
             /* XXX What should we do here? */
-            fprintf(stderr, "The length of the data was not written complete"
-                     " to the pipe\n");
+            ERR("The length of the data was not written complete"
+                " to the pipe");
             return FALSE;
          }
        else if (ret == PIPE_FD_ERROR && errno == EPIPE)
@@ -430,9 +430,9 @@ ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes)
          ;
        else
          {
-            fprintf(stderr, "An unhandled error (ret: %d errno: %d)"
-                     "occured while writing to the pipe the length\n",
-                     ret, errno);
+            ERR("An unhandled error (ret: %d errno: %d)"
+                "occured while writing to the pipe the length",
+                ret, errno);
          }
      }
    while (retry--);
@@ -464,9 +464,9 @@ ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes)
          ;
        else
          {
-            fprintf(stderr, "An unhandled error (ret: %d errno: %d)"
-                     "occured while writing to the pipe the length\n",
-                     ret, errno);
+            ERR("An unhandled error (ret: %d errno: %d)"
+                "occured while writing to the pipe the length",
+                ret, errno);
          }
      }
    while (retry--);
@@ -503,8 +503,8 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
             else if (ret > 0)
               {
                  /* XXX What should we do here? */
-                 fprintf(stderr, "Only read %d bytes from the pipe, although"
-                          " we need to read %d bytes.\n", ret, sizeof(p->len));
+                 ERR("Only read %d bytes from the pipe, although"
+                     " we need to read %d bytes.", ret, sizeof(p->len));
               }
             else if (ret == 0)
               {
@@ -519,9 +519,9 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
               return ECORE_CALLBACK_RENEW;
             else
               {
-                 fprintf(stderr, "An unhandled error (ret: %d errno: %d)"
-                          "occured while reading from the pipe the length\n",
-                          ret, errno);
+                 ERR("An unhandled error (ret: %d errno: %d)"
+                     "occured while reading from the pipe the length",
+                     ret, errno);
                   return ECORE_CALLBACK_RENEW;
               }
 #else
@@ -575,9 +575,9 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
          return ECORE_CALLBACK_RENEW;
        else
          {
-            fprintf(stderr, "An unhandled error (ret: %d errno: %d)"
-                     "occured while reading from the pipe the data\n",
-                     ret, errno);
+            ERR("An unhandled error (ret: %d errno: %d)"
+                "occured while reading from the pipe the data",
+                ret, errno);
             return ECORE_CALLBACK_RENEW;
          }
 #else
index b1c7f1f..ca9c5b3 100644 (file)
 # undef EAPI
 #endif
 
+extern int _ecore_log_dom ;
+#ifdef  _ECORE_DEFAULT_LOG_DOM
+# undef _ECORE_DEFAULT_LOG_DOM
+#endif
+#define _ECORE_DEFAULT_LOG_DOM _ecore_log_dom
+
+#ifdef ECORE_DEFAULT_LOG_COLOR
+# undef ECORE_DEFAULT_LOG_COLOR
+#endif
+#define ECORE_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
+
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
+
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
+
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
+
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
+
+#ifdef CRIT
+# undef CRIT
+#endif
+#define CRIT(...) EINA_LOG_DOM_CRIT(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
 #ifdef _WIN32
 # ifdef EFL_ECORE_BUILD
 #  ifdef DLL_EXPORT
index baa572c..89a38ed 100644 (file)
@@ -199,8 +199,8 @@ _ecore_signal_call(void)
 #endif
    sigprocmask(SIG_BLOCK, &newset, &oldset);
    if (sigchld_count > MAXSIGQ)
-     printf("ECORE WARNING. %i SIGCHLD in queue. max queue size %i. losing "
-           "siginfo for extra signals.\n", sigchld_count, MAXSIGQ);
+     WRN("%i SIGCHLD in queue. max queue size %i. losing "
+         "siginfo for extra signals.", sigchld_count, MAXSIGQ);
    for (n = 0; n < sigchld_count; n++)
      {
        pid_t pid;
@@ -271,8 +271,8 @@ _ecore_signal_call(void)
    sigchld_count = 0;
 
    if (sigusr1_count > MAXSIGQ)
-     printf("ECORE WARNING. %i SIGUSR1 in queue. max queue size %i. losing "
-           "siginfo for extra signals.\n", sigusr1_count, MAXSIGQ);
+     WRN("%i SIGUSR1 in queue. max queue size %i. losing "
+        "siginfo for extra signals.", sigusr1_count, MAXSIGQ);
    for (n = 0; n < sigusr1_count; n++)
      {
        Ecore_Event_Signal_User *e;
@@ -292,8 +292,8 @@ _ecore_signal_call(void)
    sigusr1_count = 0;
 
    if (sigusr2_count > MAXSIGQ)
-     printf("ECORE WARNING. %i SIGUSR2 in queue. max queue size %i. losing "
-           "siginfo for extra signals.\n", sigusr2_count, MAXSIGQ);
+     WRN("%i SIGUSR2 in queue. max queue size %i. losing "
+        "siginfo for extra signals.", sigusr2_count, MAXSIGQ);
    for (n = 0; n < sigusr2_count; n++)
      {
        Ecore_Event_Signal_User *e;
@@ -313,8 +313,8 @@ _ecore_signal_call(void)
    sigusr2_count = 0;
 
    if (sighup_count > MAXSIGQ)
-     printf("ECORE WARNING. %i SIGHUP in queue. max queue size %i. losing "
-           "siginfo for extra signals.\n", sighup_count, MAXSIGQ);
+     WRN("%i SIGHUP in queue. max queue size %i. losing "
+        "siginfo for extra signals.", sighup_count, MAXSIGQ);
    for (n = 0; n < sighup_count; n++)
      {
        Ecore_Event_Signal_Hup *e;
@@ -332,8 +332,8 @@ _ecore_signal_call(void)
    sighup_count = 0;
 
    if (sigquit_count > MAXSIGQ)
-     printf("ECORE WARNING. %i SIGQUIT in queue. max queue size %i. losing "
-           "siginfo for extra signals.\n", sigquit_count, MAXSIGQ);
+     WRN("%i SIGQUIT in queue. max queue size %i. losing "
+        "siginfo for extra signals.", sigquit_count, MAXSIGQ);
    for (n = 0; n < sigquit_count; n++)
      {
        Ecore_Event_Signal_Exit *e;
@@ -353,8 +353,8 @@ _ecore_signal_call(void)
    sigquit_count = 0;
 
    if (sigint_count > MAXSIGQ)
-     printf("ECORE WARNING. %i SIGINT in queue. max queue size %i. losing "
-           "siginfo for extra signals.\n", sigint_count, MAXSIGQ);
+     WRN("%i SIGINT in queue. max queue size %i. losing "
+        "siginfo for extra signals.", sigint_count, MAXSIGQ);
    for (n = 0; n < sigint_count; n++)
      {
        Ecore_Event_Signal_Exit *e;
@@ -374,8 +374,8 @@ _ecore_signal_call(void)
    sigint_count = 0;
 
    if (sigterm_count > MAXSIGQ)
-     printf("ECORE WARNING. %i SIGTERM in queue. max queue size %i. losing "
-           "siginfo for extra signals.\n", sigterm_count, MAXSIGQ);
+     WRN("%i SIGTERM in queue. max queue size %i. losing "
+        "siginfo for extra signals.", sigterm_count, MAXSIGQ);
    for (n = 0; n < sigterm_count; n++)
      {
        Ecore_Event_Signal_Exit *e;
@@ -396,8 +396,8 @@ _ecore_signal_call(void)
 
 #ifdef SIGPWR
    if (sigpwr_count > MAXSIGQ)
-     printf("ECORE WARNING. %i SIGPWR in queue. max queue size %i. losing "
-           "siginfo for extra signals.\n", sigpwr_count, MAXSIGQ);
+     WRN("%i SIGPWR in queue. max queue size %i. losing "
+        "siginfo for extra signals.", sigpwr_count, MAXSIGQ);
    for (n = 0; n < sigpwr_count; n++)
      {
        Ecore_Event_Signal_Power *e;
@@ -419,8 +419,8 @@ _ecore_signal_call(void)
    for (i = 0; i < num; i++)
      {
        if (sigrt_count[i] > MAXSIGQ)
-         printf("ECORE WARNING. %i SIGRT%i in queue. max queue size %i. losing "
-                "siginfo for extra signals.\n", i + 1, sigrt_count[i], MAXSIGQ);
+         WRN("%i SIGRT%i in queue. max queue size %i. losing "
+             "siginfo for extra signals.", i + 1, sigrt_count[i], MAXSIGQ);
        for (n = 0; n < sigrt_count[i]; n++)
          {
             Ecore_Event_Signal_Realtime *e;
index 7a884ac..3a5d074 100644 (file)
@@ -68,7 +68,7 @@ ecore_timer_precision_set(double value)
 {
    if (value < 0.0)
      {
-       fprintf(stderr, "ERROR: precision %f less than zero, ignored\n", value);
+       ERR("Precision %f less than zero, ignored", value);
        return;
      }
    precision = value;
index ea098f6..d1392c7 100644 (file)
@@ -53,13 +53,12 @@ EAPI const unsigned int ecore_prime_table[] =
 EAPI void
 ecore_print_warning(const char *function, const char *sparam)
 {
-   fprintf(stderr, "***** Developer Warning ***** :\n"
-          "\tThis program is calling:\n\n"
-          "\t%s();\n\n"
-          "\tWith the parameter:\n\n"
-          "\t%s\n\n"
-          "\tbeing NULL. Please fix your program.\n", function, sparam);
-   fflush(stderr);
+   WRN("***** Developer Warning ***** :\n"
+       "\tThis program is calling:\n\n"
+       "\t%s();\n\n"
+       "\tWith the parameter:\n\n"
+       "\t%s\n\n"
+       "\tbeing NULL. Please fix your program.", function, sparam);
    if (getenv("ECORE_ERROR_ABORT")) abort();
 }
 
index 9ae3f02..562c515 100644 (file)
@@ -65,7 +65,7 @@ EAPI int ECORE_CON_EVENT_SERVER_DATA = 0;
 
 static Eina_List *servers = NULL;
 static int _ecore_con_init_count = 0;
-
+int _ecore_con_log_dom = -1;
 #define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
 #define LENGTH_OF_ABSTRACT_SOCKADDR_UN(s, path) (strlen(path) + 1 + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
 
@@ -91,6 +91,13 @@ ecore_con_init(void)
    if (!ecore_init())
      return --_ecore_con_init_count;
 
+   _ecore_con_log_dom = eina_log_domain_register("EcoreCon", ECORE_DEFAULT_LOG_COLOR);
+   if(_ecore_con_log_dom < 0)
+     {
+       EINA_LOG_ERR("Impossible to create a log domain foe Ecore Con.");
+       ecore_shutdown();
+       return --_ecore_con_init_count;
+     }
    ECORE_CON_EVENT_CLIENT_ADD = ecore_event_type_new();
    ECORE_CON_EVENT_CLIENT_DEL = ecore_event_type_new();
    ECORE_CON_EVENT_SERVER_ADD = ecore_event_type_new();
@@ -117,14 +124,15 @@ ecore_con_shutdown(void)
 {
    if (--_ecore_con_init_count != 0)
      return _ecore_con_init_count;
-
+   
    while (servers)
      _ecore_con_server_free(eina_list_data_get(servers));
 
    ecore_con_info_shutdown();
    ecore_con_dns_shutdown();
    ecore_con_ssl_shutdown();
-
+   eina_log_domain_unregister(_ecore_con_log_dom);
+   _ecore_con_log_dom = -1;
    ecore_shutdown();
 
    return _ecore_con_init_count;
@@ -252,7 +260,7 @@ ecore_con_server_add(Ecore_Con_Type compl_type, const char *name, int port,
             socket_unix.sun_path[0] = '\0';
             socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, name);
 #else
-            fprintf(stderr, "Your system does not support abstract sockets!\n");
+            ERR("Your system does not support abstract sockets!");
             goto error_umask;
 #endif
          }
@@ -418,7 +426,7 @@ ecore_con_server_connect(Ecore_Con_Type compl_type, const char *name, int port,
             socket_unix.sun_path[0] = '\0';
             socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, name);
 #else
-            fprintf(stderr, "Your system does not support abstract sockets!\n");
+            WRN("Your system does not support abstract sockets!");
             goto error;
 #endif
          }
@@ -887,10 +895,10 @@ _ecore_con_server_free(Ecore_Con_Server *svr)
        t = ecore_time_get();
        if ((t - t_start) > 0.5)
          {
-            printf("ECORE_CON: EEK - stuck in _ecore_con_server_free() trying\n"
-                   "  to flush data out from the server, and have been for\n"
-                   "  %1.1f seconds. This is taking too long. Aborting flush.\n",
-                   (t - t_start));
+           WRN("ECORE_CON: EEK - stuck in _ecore_con_server_free() trying\n"
+                "  to flush data out from the server, and have been for\n"
+                "  %1.1f seconds. This is taking too long. Aborting flush.",
+                (t - t_start));
             break;
          }
      }
@@ -922,10 +930,10 @@ _ecore_con_client_free(Ecore_Con_Client *cl)
        t = ecore_time_get();
        if ((t - t_start) > 0.5)
          {
-            printf("ECORE_CON: EEK - stuck in _ecore_con_client_free() trying\n"
-                   "  to flush data out from the client, and have been for\n"
-                   "  %1.1f seconds. This is taking too long. Aborting flush.\n",
-                   (t - t_start));
+            WRN("EEK - stuck in _ecore_con_client_free() trying\n"
+                "  to flush data out from the client, and have been for\n"
+                "  %1.1f seconds. This is taking too long. Aborting flush.",
+                (t - t_start));
             break;
          }
      }
index 6f0ba10..17aebb2 100644 (file)
 
 #define READBUFSIZ 65536
 
+extern int  _ecore_con_log_dom ;
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_ecore_con_log_dom, __VA_ARGS__)
+
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_ecore_con_log_dom, __VA_ARGS__)
+
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_ecore_con_log_dom, __VA_ARGS__)
+
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_ecore_con_log_dom, __VA_ARGS__)
+
+#ifdef CRIT
+# undef CRIT
+#endif
+#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_con_log_dom, __VA_ARGS__)
+
 typedef enum _Ecore_Con_State
   {
     ECORE_CON_CONNECTED,
index ccfb980..482912e 100644 (file)
@@ -1035,7 +1035,7 @@ _ecore_con_url_read_cb(void *ptr, size_t size, size_t nitems, void *stream)
         fclose((FILE*)stream);
         return 0;
      }
-   fprintf(stderr, "*** We read %zu bytes from file\n", retcode);
+   INF("*** We read %zu bytes from file", retcode);
    return retcode;
 }
 
index 8e6650f..bdf52d5 100644 (file)
@@ -23,7 +23,7 @@
 #include "ecore_config_ipc.h"
 
 #include "ecore_config_util.h"
-
+int  _ecore_config_log_dom = -1;
 int                  DEBUG = 0;
 EAPI Ecore_Config_Server *__ecore_config_server_global = NULL;
 EAPI Ecore_Config_Server *__ecore_config_server_local = NULL;
@@ -336,7 +336,7 @@ ecore_config_as_string_get(const char *key)
    val = NULL;
    r = NULL;
    if (!(e = ecore_config_get(key)))
-      E(0, "no such property, \"%s\"...\n", key);
+      ERR(0, "no such property, \"%s\"...", key);
    else
      {
        switch (e->type)
@@ -391,15 +391,13 @@ ecore_config_bound(Ecore_Config_Prop * e)
      {
        if ((e->val < e->lo))
          {
-            E(0,
-              "ecore_config_bounds(\"%s\",%ld): value out of range; adjusted to %ld...\n",
+           WRN("ecore_config_bounds(\"%s\",%ld): value out of range; adjusted to %ld...",
               e->key, e->val, e->lo);
             e->val = e->lo;
          }
        else if ((e->val > e->hi))
          {
-            E(0,
-              "ecore_config_bounds(\"%s\",%ld): value out of range; adjusted to %ld...\n",
+           WRN("ecore_config_bounds(\"%s\",%ld): value out of range; adjusted to %ld...",
               e->key, e->val, e->hi);
             e->val = e->hi;
          }
@@ -415,14 +413,12 @@ ecore_config_bound(Ecore_Config_Prop * e)
        if (v != e->val)
          {
             if (e->type == ECORE_CONFIG_FLT)
-               E(0,
-                 "ecore_config_bound(\"%s\"): float value %f not a multiple of %f, adjusted to %f...\n",
+              WRN("ecore_config_bound(\"%s\"): float value %f not a multiple of %f, adjusted to %f...",
                  e->key, ((double)e->val) / ECORE_CONFIG_FLOAT_PRECISION,
                  ((double)e->step) / ECORE_CONFIG_FLOAT_PRECISION,
                  ((double)v) / ECORE_CONFIG_FLOAT_PRECISION);
             else
-               E(0,
-                 "ecore_config_bound(\"%s\"): integer value %ld not a multiple of %ld, adjusted to %ld...\n",
+              WRN("ecore_config_bound(\"%s\"): integer value %ld not a multiple of %ld, adjusted to %ld...",
                  e->key, e->val, e->step, v);
             ret = ECORE_CONFIG_ERR_SUCC;
             e->val = v;
@@ -677,9 +673,8 @@ ecore_config_typed_set(const char *key, const void *val, int type)
      }
    else
      {
-       E(0,
-         "ecore_config_typed_set(\"%s\"): ecore_config_typed_val() failed: %d\n",
-         key, ret);
+       ERR("ecore_config_typed_set(\"%s\"): ecore_config_typed_val() failed: %d",
+           key, ret);
      }
 
    return ret;
@@ -1157,8 +1152,8 @@ ecore_config_theme_default(const char *key, const char *val)
 EAPI int
 ecore_config_struct_create(const char *key)
 {
-   printf("WARNING: you are using ecore_config structures. These are very young");
-   printf(" and not complete - you have been warned");
+   WRN("you are using ecore_config structures. These are very young");
+   WRN(" and not complete - you have been warned");
 
    return ecore_config_typed_default(key, NULL, ECORE_CONFIG_SCT);
 }
@@ -1351,7 +1346,7 @@ ecore_config_struct_get(const char *key, void *data)
               ptr += sizeof(int);
             break;
             default:
-              printf("ARGH - STRUCT coding not implemented yet\n");
+              WRN("ARGH - STRUCT coding not implemented yet");
          }
        l = eina_list_next(l);
      }
@@ -1391,13 +1386,13 @@ ecore_config_listen(const char *name, const char *key,
 
        if (ret != ECORE_CONFIG_ERR_SUCC)
          {
-            E(0, "ecore_config_listen: ecore_config_add(\"%s\") failed: %d\n",
-              key, ret);
+            ERR("ecore_config_listen: ecore_config_add(\"%s\") failed: %d",
+                key, ret);
             return ret;
          }
        if (!(e = ecore_config_get(key)))
          {
-            E(0, "ecore_config_listen: list of properties corrupted!?\n");
+            ERR("ecore_config_listen: list of properties corrupted!?");
             return ECORE_CONFIG_ERR_FAIL;
          }
      }
@@ -1405,8 +1400,7 @@ ecore_config_listen(const char *name, const char *key,
    for (l = e->listeners; l; l = l->next)
       if (!strcmp(l->name, name) || (l->listener == listener))
        {
-          E(1,
-            "ecore_config_listen: %s is already listening for changes of %s...\n",
+          ERR("ecore_config_listen: %s is already listening for changes of %s...",
             name, key);
           return ECORE_CONFIG_ERR_IGNORED;
        }
@@ -1414,7 +1408,7 @@ ecore_config_listen(const char *name, const char *key,
    if (!(l = malloc(sizeof(Ecore_Config_Listener_List))))
       return ECORE_CONFIG_ERR_OOM;
 
-   E(1, "registering listener \"%s\" for \"%s\" (%d)...\n", name, key, e->type);
+   ERR("registering listener \"%s\" for \"%s\" (%d)...", name, key, e->type);
 
    memset(l, 0, sizeof(Ecore_Config_Listener_List));
 
@@ -1680,6 +1674,12 @@ ecore_config_init(const char *name)
 {
    char                *path;
    Ecore_Config_Prop   *list;
+   _ecore_config_log_dom = eina_log_domain_register("EcoreConfig", ECORE_DEFAULT_LOG_COLOR);
+   if(_ecore_config_log_dom < 0) 
+     {
+       EINA_LOG_ERR("Impossible to create a log domain for the Ecore config module.");
+       return -1;
+     }
    _ecore_config_system_init_no_load();
 
    __ecore_config_app_name = strdup(name);
@@ -1836,6 +1836,8 @@ ecore_config_system_shutdown(void)
    free(__ecore_config_bundle_local);
    free(__ecore_config_server_local);
    free(__ecore_config_server_global);
+   eina_log_domain_unregister(_ecore_config_log_dom);
+   _ecore_config_log_dom = -1;
    return ret;
 }
 
@@ -1862,7 +1864,7 @@ __ecore_argbstr_to_long(const char *argb, long *v)
 
    if(*l)
      {
-       E(0, "ecore_config_val: value \"%s\" not a valid hexadecimal RGB value?\n", argb);
+       ERR("ecore_config_val: value \"%s\" not a valid hexadecimal RGB value?", argb);
        return NULL;
      }
 
index 96bcb0b..bb5e12a 100644 (file)
@@ -182,10 +182,10 @@ _ecore_config_db_read(Ecore_Config_DB_File *db, const char *key)
               ecore_config_typed_set(key, (void *)value, type);
               break;
             case ECORE_CONFIG_SCT:
-              printf("loading struct %s\n", key);
+              INF("loading struct %s", key);
               break;
             default:
-              E(0, "Type %d not handled\n", type);
+              WRN("Type %d not handled", type);
          }
        free(data);
        return 1;
@@ -263,7 +263,7 @@ _ecore_config_db_write(Ecore_Config_DB_File *db, Ecore_Config_Prop *e)
           val = _ecore_config_argbstr_get(e);
           break;
        default:
-          E(0, "Type %d not handled\n", e->type);
+          WRN("Type %d not handled", e->type);
      }
 
    if (prev_locale)
index 4b8dce1..10d22a6 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "Ecore_Config.h"
 #include "Ecore.h"
-
+#include "ecore_config_private.h"
 typedef struct __Ecore_Config_Arg_Callback _Ecore_Config_Arg_Callback;
 struct __Ecore_Config_Arg_Callback
 {
@@ -531,9 +531,9 @@ ecore_config_args_display(void)
    _Ecore_Config_Arg_Callback *callbacks;
 
    if (__ecore_config_app_description)
-      printf("%s\n\n", __ecore_config_app_description);
-   printf("Supported Options:\n");
-   printf(" -h, --help\t       Print this text\n");
+      ERR("%s\n\n", __ecore_config_app_description);
+   ERR("Supported Options:");
+   ERR(" -h, --help\t       Print this text");
    if (!__ecore_config_bundle_local)
       return;
    props = __ecore_config_bundle_local->data;
@@ -545,7 +545,7 @@ ecore_config_args_display(void)
             props = props->next;
             continue;
          }
-       printf(" %c%c%c --%s\t%s %s\n", props->short_opt ? '-' : ' ',
+       INF(" %c%c%c --%s\t%s %s", props->short_opt ? '-' : ' ',
               props->short_opt ? props->short_opt : ' ',
               props->short_opt ? ',' : ' ',
               props->long_opt ? props->long_opt : props->key,
@@ -558,7 +558,7 @@ ecore_config_args_display(void)
    callbacks = _ecore_config_arg_callbacks;
    while (callbacks)
      {
-        printf(" %c%c%c --%s\t%s %s\n", callbacks->short_opt ? '-' : ' ',
+        INF(" %c%c%c --%s\t%s %s", callbacks->short_opt ? '-' : ' ',
               callbacks->short_opt ? callbacks->short_opt : ' ',
               callbacks->short_opt ? ',' : ' ',
               callbacks->long_opt ? callbacks->long_opt : "",
@@ -577,9 +577,9 @@ ecore_config_parse_set(Ecore_Config_Prop * prop, char *arg, char *opt,
    if (!arg)
      {
        if (opt)
-          printf("Missing expected argument for option --%s\n", opt);
+          ERR("Missing expected argument for option --%s", opt);
        else
-          printf("Missing expected argument for option -%c\n", opt2);
+          ERR("Missing expected argument for option -%c", opt2);
        return ECORE_CONFIG_PARSE_EXIT;
      }
    else
@@ -652,7 +652,7 @@ ecore_config_args_parse(void)
 
        if (*arg != '-')
          {
-            printf("Unexpected attribute \"%s\"\n", arg);
+            ERR("Unexpected attribute \"%s\"", arg);
             nextarg++;
             continue;
          }
@@ -705,7 +705,7 @@ ecore_config_args_parse(void)
                              {
                                 if (!argv[++nextarg])
                                   {
-                                     printf("Missing expected argument for option --%s\n", long_opt);
+                                     ERR("Missing expected argument for option --%s", long_opt);
                                      return ECORE_CONFIG_PARSE_EXIT;
                                   }
                                   callback->func(argv[nextarg], callback->data);
@@ -717,8 +717,8 @@ ecore_config_args_parse(void)
               }
             if (!found)
               {
-                 printf("Unrecognised option \"%s\"\n", long_opt);
-                 printf("Try using -h or --help for more information.\n\n");
+                 ERR("Unrecognised option \"%s\"", long_opt);
+                 ERR("Try using -h or --help for more information.\n");
                  return ECORE_CONFIG_PARSE_EXIT;
               }
          }
@@ -768,7 +768,7 @@ ecore_config_args_parse(void)
                                        {
                                           if (!argv[++nextarg])
                                             {
-                                               printf("Missing expected argument for option -%c\n", short_opt);
+                                               ERR("Missing expected argument for option -%c", short_opt);
                                                return ECORE_CONFIG_PARSE_EXIT;
                                             }
                                           callback->func(argv[nextarg], callback->data);
@@ -780,9 +780,8 @@ ecore_config_args_parse(void)
                         }
                       if (!found)
                         {
-                           printf("Unrecognised option '%c'\n", short_opt);
-                           printf
-                              ("Try using -h or --help for more information.\n\n");
+                           ERR("Unrecognised option '%c'", short_opt);
+                           ERR("Try using -h or --help for more information.\n");
                            return ECORE_CONFIG_PARSE_EXIT;
                         }
                    }
index ebe3df6..662bc09 100644 (file)
@@ -49,7 +49,7 @@ _ecore_config_ipc_ecore_string_get(char **m, char **r)
    *r = q;
    q += l;
    *m = q;
-   E(1, "IPC/eCore: got string-%d \"%s\"\n", l, *r);
+   WRN("IPC/eCore: got string-%d \"%s\"", l, *r);
    return ECORE_CONFIG_ERR_SUCC;
 }
 
@@ -139,7 +139,7 @@ _ecore_config_ipc_ecore_send(Ecore_Ipc_Event_Client_Data * e, int code,
    int                 len = reply ? strlen(reply) + 1 : 0;
 
    our_ref++;
-   E(1, "IPC/eCore: replying [0,0] %d IRT %d => %d {\"%s\":%d}\n", our_ref,
+   WRN("IPC/eCore: replying [0,0] %d IRT %d => %d {\"%s\":%d}", our_ref,
      e->ref, code, reply ? reply : "", len);
    return ecore_ipc_client_send(e->client, 0, 0, our_ref, e->ref, code, reply,
                                len);
@@ -160,7 +160,7 @@ _ecore_config_ipc_ecore_handle_request(Ecore_Ipc_Server * server,
    serial = e->minor;
    r = NULL;
    m = (char *)e->data;
-   E(1, "IPC/eCore: client sent: [%d,%d] #%d (%d) @ %p\n", e->major, e->minor,
+   INF("IPC/eCore: client sent: [%d,%d] #%d (%d) @ %p", e->major, e->minor,
      e->ref, e->size, server);
 
    switch (e->major)
@@ -247,7 +247,7 @@ _ecore_config_ipc_client_add(void *data, int type __UNUSED__, void *event)
    if (*server != ecore_ipc_client_server_get(e->client))
       return 1;
 
-   E(1, "IPC/eCore: Client connected. @ %p\n", server);
+   INF("IPC/eCore: Client connected. @ %p", server);
    return 1;
 }
 
@@ -263,7 +263,7 @@ _ecore_config_ipc_client_del(void *data, int type __UNUSED__, void *event)
    if (*server != ecore_ipc_client_server_get(e->client))
       return 1;
 
-   E(1, "IPC/eCore: Client disconnected. @ %p\n", server);
+   INF("IPC/eCore: Client disconnected. @ %p", server);
    return 1;
 }
 
@@ -317,7 +317,7 @@ _ecore_config_ipc_ecore_init(const char *pipe_name, void **data)
 
             if (!stat(socket, &st))
               {
-                 E(0, "IPC/eCore: pipe \"%s\" already exists!?\n", socket);
+                 INF("IPC/eCore: pipe \"%s\" already exists!?", socket);
 /*      if(unlink(buf))
        E(0,"IPC/eCore: could not remove pipe \"%s\": %d\n",buf,errno); }}*/
                  port++;
@@ -338,7 +338,7 @@ _ecore_config_ipc_ecore_init(const char *pipe_name, void **data)
 
    if (server)
      {
-       E(1, "IPC/eCore: Server is listening on %s.\n", pipe_name);
+       INF("IPC/eCore: Server is listening on %s.", pipe_name);
      }
 
    return ECORE_CONFIG_ERR_SUCC;
index 704878f..edb7ed1 100644 (file)
@@ -132,8 +132,8 @@ _ecore_config_ipc_prop_set(Ecore_Config_Server * srv, const long serial,
 
    theme = ecore_config_bundle_by_serial_get(srv, serial);
    ret = ecore_config_set(key, (char *)val);
-   E(1, "ipc.prop.set(%s->%s,\"%s\") => %d\n", theme ? theme->identifier : "",
-     key, val, ret);
+   ERR("ipc.prop.set(%s->%s,\"%s\") => %d\n", theme ? theme->identifier : "",
+       key, val, ret);
    return ret;
 #else
    return ECORE_CONFIG_ERR_NOTSUPP;
@@ -259,11 +259,11 @@ _ecore_config_ipc_init(const char *pipe_name)
    memset(list, 0, sizeof(Ecore_Config_Server));
    if ((ret = _ecore_config_ipc_ecore_init(pipe_name, &list->server)) != ECORE_CONFIG_ERR_SUCC)
      {
-       E(2, "_ecore_config_ipc_init: failed to register %s, code %d\n",
+       ERR("_ecore_config_ipc_init: failed to register %s, code %d",
          pipe_name, ret);
      }
 
-   E(2, "_ecore_config_ipc_init: registered \"%s\"...\n", pipe_name);
+   ERR("_ecore_config_ipc_init: registered \"%s\"...", pipe_name);
 
    list->name = strdup(pipe_name);
    list->next = __ecore_config_servers;
index 3beee54..233bfcb 100644 (file)
@@ -1,15 +1,37 @@
 #ifndef _ECORE_CONFIG_PRIVATE_H
 # define _ECORE_CONFIG_PRIVATE_H
 
+ /* eina_log related things */
+extern int _ecore_config_log_dom;
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_ecore_config_log_dom, __VA_ARGS__)
+
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_ecore_config_log_dom, __VA_ARGS__)
+
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_ecore_config_log_dom, __VA_ARGS__)
+
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_ecore_config_log_dom, __VA_ARGS__)
+
+#ifdef CRIT
+# undef CRIT
+#endif
+#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_config_log_dom, __VA_ARGS__)
 /* debug */
 extern int               DEBUG;
-#ifdef __sgi
-# define D
-# define E
-#else
-# define D(fmt,args...) do { if(DEBUG>=0) fprintf(stderr,fmt,## args); } while(0);
-# define E(lvl,args...) do { if(DEBUG>=(lvl)) fprintf(stderr,## args); } while(0)
-#endif
 
 typedef struct _Ecore_Config_DB_File Ecore_Config_DB_File;
 
index 6a65f6b..e2c54df 100644 (file)
@@ -84,7 +84,7 @@ ecore_config_file_load(const char *file)
    db = _ecore_config_db_open_read(file);
    if (!db)
      {
-       E(0, "Cannot open database from file %s!\n", file);
+       ERR("Cannot open database from file %s!", file);
        return ECORE_CONFIG_ERR_NODATA;
      }
    key_count = 0;   
@@ -154,7 +154,7 @@ ecore_config_file_save(const char *file)
    db = _ecore_config_db_open_write(file);
    if (!db)
      {
-       E(0, "Cannot open database from file %s!\n", file);
+       ERR("Cannot open database from file %s!", file);
        return ECORE_CONFIG_ERR_FAIL;
      }
 
index 191be53..515cf5f 100644 (file)
@@ -23,7 +23,7 @@
  * - handle all event types
  * - 
  * */
-
+int _ecore_directfb_log_dom = -1;
 static int _ecore_directfb_init_count = 0;
 
 static int _window_event_fd = 0;
@@ -159,7 +159,7 @@ _ecore_directfb_event_handle_key_down(DFBEvent *evt)
 
                        if(!k) 
                        {
-                               printf("error en el numero, %0X\n", evt->input.key_symbol);
+                               ERR("error en el numero, %0X", evt->input.key_symbol);
                                return;
                        }
                        e->name = strdup(k->name);
@@ -175,7 +175,7 @@ _ecore_directfb_event_handle_key_down(DFBEvent *evt)
 
                        if(!k) 
                        {
-                               printf("error en el numero, %0X\n", evt->window.key_symbol);
+                               ERR("error en el numero, %0X", evt->window.key_symbol);
                                return;
                        }
                        e->name = strdup(k->name);
@@ -208,7 +208,7 @@ _ecore_directfb_event_handle_key_up(DFBEvent *evt)
                        
                        if(!k) 
                        {
-                               printf("error en el numero, %0X\n", evt->input.key_symbol);
+                               ERR("error en el numero, %0X", evt->input.key_symbol);
                                return;
                        }
                        e->name = strdup(k->name);
@@ -224,7 +224,7 @@ _ecore_directfb_event_handle_key_up(DFBEvent *evt)
 
                        if(!k) 
                        {
-                               printf("error en el numero, %0X\n", evt->window.key_symbol);
+                               ERR("error en el numero, %0X", evt->window.key_symbol);
                                return;
                        }
                        e->name = strdup(k->name);
@@ -428,13 +428,13 @@ _ecore_directfb_window_event_fd_handler(void *data __UNUSED__,Ecore_Fd_Handler *
        if (v < 1) return 1;
                        
        if(evt.window.type & DWET_POSITION)
-               printf("position\n");
+               INF("position");
        if(evt.window.type & DWET_SIZE)
-               printf("size\n");
+               INF("size");
        if(evt.window.type & DWET_CLOSE)
-               printf("close\n");
+               INF("close");
        if(evt.window.type & DWET_DESTROYED)
-               printf("destroyed\n");
+               INF("destroyed");
        if(evt.window.type & DWET_GOTFOCUS)
                _ecore_directfb_event_handle_got_focus(&evt.window);
        if(evt.window.type & DWET_LOSTFOCUS)
@@ -659,7 +659,12 @@ ecore_directfb_init(const char *name __UNUSED__)
        int i = 0;
        
        if (++_ecore_directfb_init_count != 1) return _ecore_directfb_init_count;
-       
+       _ecore_directfb_log_dom = eina_log_domain_register("EcoreDirectFB", ECORE_DEFAULT_LOG_COLOR);
+       if(_ecore_directfb_log_dom < 0) 
+         {
+           EINA_LOG_ERR("Impossible to create a log domain for the Ecore directFB module.");
+           return _ecore_directfb_init_count--;
+         }
        DFBCHECK(DirectFBInit(NULL,NULL));
        DFBCHECK(DirectFBCreate(&_dfb));
        
@@ -718,6 +723,7 @@ ecore_directfb_shutdown(void)
        DFBCHECK(_window_event->Release(_window_event));        
        DFBCHECK(_layer->Release(_layer));
        DFBCHECK(_dfb->Release(_dfb));
-       
+       eina_log_domain_unregister(_ecore_directfb_log_dom);
+       _ecore_directfb_log_dom = -1;
        return _ecore_directfb_init_count;
 }
index fc9ef5e..0977a2f 100644 (file)
@@ -1,9 +1,38 @@
+
+/* eina_log related things */
+
+extern int _ecore_directfb_log_dom;
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_ecore_directfb_log_dom, __VA_ARGS__)
+
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_ecore_directfb_log_dom, __VA_ARGS__)
+
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_ecore_directfb_log_dom, __VA_ARGS__)
+
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_ecore_directfb_log_dom, __VA_ARGS__)
+
+#ifdef CRIT
+# undef CRIT
+#endif
+#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_directfb_log_dom, __VA_ARGS__)
+
 /* macro for a safe call to DirectFB functions */
 #define DFBCHECK(x...) \
      {                                                                 \
           _err = x;                                                    \
           if (_err != DFB_OK) {                                        \
-               fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ );  \
+               CRIT("%s <%d>:\n\t", __FILE__, __LINE__ );              \
                DirectFBErrorFatal( #x, _err );                         \
           }                                                            \
      }
index a04ebb3..2183397 100644 (file)
@@ -163,10 +163,10 @@ ecore_evas_init(void)
    if (!ecore_init())
      goto shutdown_evas;
 
-   _ecore_evas_log_dom = eina_log_domain_register("Ecore_Evas", ECORE_EVAS_DEFAULT_LOG_COLOR);
+   _ecore_evas_log_dom = eina_log_domain_register("Ecore_Evas", ECORE_DEFAULT_LOG_COLOR);
    if(_ecore_evas_log_dom < 0) 
      {
-       EINA_LOG_ERR("Impossible to create a log domain for Ecore_Evas.\n");
+       EINA_LOG_ERR("Impossible to create a log domain for Ecore_Evas.");
        goto shutdown_ecore;
      }
 
@@ -220,6 +220,7 @@ ecore_evas_shutdown(void)
      ecore_main_fd_handler_del(_ecore_evas_async_events_fd);
 
    eina_log_domain_unregister(_ecore_evas_log_dom);
+   _ecore_evas_log_dom = -1;
    ecore_shutdown();
    evas_shutdown();
 
index 7e00980..026fb4c 100644 (file)
 
 extern int _ecore_evas_log_dom;
 
-#ifdef ECORE_EVAS_DEFAULT_LOG_COLOR
-# undef ECORE_EVAS_DEFAULT_LOG_COLOR
-#endif
-#define ECORE_EVAS_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
 #ifdef ERR
 # undef ERR
 #endif
index 318d6ff..b04b35e 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "ecore_file_private.h"
 
-
+int _ecore_file_log_dom = -1;
 static int _ecore_file_init_count = 0;
 
 /* externally accessible functions */
@@ -41,7 +41,12 @@ ecore_file_init()
 {
    if (++_ecore_file_init_count != 1)
      return _ecore_file_init_count;
-
+   _ecore_file_log_dom = eina_log_domain_register("EcoreFile", ECORE_DEFAULT_LOG_COLOR);
+   if(_ecore_file_log_dom < 0) 
+     {
+       EINA_LOG_ERR("Impossible to create a log domain for the ecore file module.");
+       return --_ecore_file_init_count;
+     }
    ecore_file_path_init();
    ecore_file_monitor_init();
    ecore_file_download_init();
@@ -81,7 +86,8 @@ ecore_file_shutdown()
    ecore_file_download_shutdown();
    ecore_file_monitor_shutdown();
    ecore_file_path_shutdown();
-
+   eina_log_domain_unregister(_ecore_file_log_dom);
+   _ecore_file_log_dom = -1;
    return _ecore_file_init_count;
 }
 
index af68cf7..9ae4613 100644 (file)
@@ -274,7 +274,7 @@ _ecore_file_monitor_inotify_monitor(Ecore_File_Monitor *em, const char *path)
                                                          path, mask);
    if (ECORE_FILE_MONITOR_INOTIFY(em)->wd < 0)
      {
-       printf("inotify_add_watch error\n");
+       ERR("inotify_add_watch error");
        ecore_file_monitor_inotify_del(em);
        return 0;
      }
@@ -314,35 +314,35 @@ _ecore_file_monitor_inotify_print(char *file, int mask)
 
    if (mask & IN_MODIFY)
      {
-       printf("Inotify modified %s: %s\n", type, file);
+       WRN("Inotify modified %s: %s", type, file);
      }
    if (mask & IN_MOVED_FROM)
      {
-       printf("Inotify moved from %s: %s\n", type, file);
+       WRN("Inotify moved from %s: %s", type, file);
      }
    if (mask & IN_MOVED_TO)
      {
-       printf("Inotify moved to %s: %s\n", type, file);
+       WRN("Inotify moved to %s: %s", type, file);
      }
    if (mask & IN_DELETE)
      {
-       printf("Inotify delete %s: %s\n", type, file);
+       WRN("Inotify delete %s: %s", type, file);
      }
    if (mask & IN_CREATE)
      {
-       printf("Inotify create %s: %s\n", type, file);
+       WRN("Inotify create %s: %s", type, file);
      }
    if (mask & IN_DELETE_SELF)
      {
-       printf("Inotify delete self %s: %s\n", type, file);
+       WRN("Inotify delete self %s: %s", type, file);
      }
    if (mask & IN_MOVE_SELF)
      {
-       printf("Inotify move self %s: %s\n", type, file);
+       WRN("Inotify move self %s: %s", type, file);
      }
    if (mask & IN_UNMOUNT)
      {
-       printf("Inotify unmount %s: %s\n", type, file);
+       WRN("Inotify unmount %s: %s", type, file);
      }
 }
 #endif
index 5fe5a2e..073e446 100644 (file)
 
 #include "Ecore_File.h"
 
+extern int _ecore_file_log_dom;
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_ecore_file_log_dom, __VA_ARGS__)
+
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_ecore_file_log_dom, __VA_ARGS__)
+
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_ecore_file_log_dom, __VA_ARGS__)
+
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_ecore_file_log_dom, __VA_ARGS__)
+
+#ifdef CRIT
+# undef CRIT
+#endif
+#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_file_log_dom, __VA_ARGS__)
+
 /* ecore_file_monitor */
 int  ecore_file_monitor_init(void);
 void ecore_file_monitor_shutdown(void);
index ff5d251..f563519 100644 (file)
@@ -18,6 +18,7 @@ EAPI int ECORE_IMF_EVENT_PREEDIT_CHANGED = 0;
 EAPI int ECORE_IMF_EVENT_COMMIT = 0;
 EAPI int ECORE_IMF_EVENT_DELETE_SURROUNDING = 0;
 
+int _ecore_imf_log_dom = -1;
 static int _ecore_imf_init_count = 0;
 
 /**
@@ -41,7 +42,13 @@ ecore_imf_init(void)
 
    if (!ecore_init())
      return --_ecore_imf_init_count;
-
+   _ecore_imf_log_dom = eina_log_domain_register("EcoreIMF", ECORE_DEFAULT_LOG_COLOR);
+   if(_ecore_imf_log_dom < 0) 
+     {
+       EINA_LOG_ERR("Impossible to create a log domain for the Ecore IMF module.");
+       ecore_shutdown();
+       return --_ecore_imf_init_count;
+     }
    ecore_imf_module_init();
 
    ECORE_IMF_EVENT_PREEDIT_START = ecore_event_type_new();
@@ -67,6 +74,7 @@ ecore_imf_shutdown(void)
 
    ecore_shutdown();
    ecore_imf_module_shutdown();
-
+   eina_log_domain_unregister(_ecore_imf_log_dom);
+   _ecore_imf_log_dom = -1;
    return _ecore_imf_init_count;
 }
index 9ae303e..65b998d 100644 (file)
@@ -199,26 +199,26 @@ _ecore_imf_module_load_all(void)
        plugin = ecore_plugin_load(ecore_imf_modules_path, filename, NULL);
        if (!plugin)
          {
-            fprintf(stderr, "** ecore_imf: Error loading input method plugin %s!\n",
-                    filename);
+            ERR("** Error loading input method plugin %s!",
+                filename);
             continue;
          }
 
        imf_module_init = ecore_plugin_symbol_get(plugin, "imf_module_init");
        if (!imf_module_init || !imf_module_init(&info) || !info)
          {
-            fprintf(stderr, "** ecore_imf: Error initializing input method plugin %s! "
-                            "'imf_module_init' is missing or failed to run!",
-                    filename);
+            ERR("** Error initializing input method plugin %s! "
+                "'imf_module_init' is missing or failed to run!",
+                filename);
             ecore_plugin_unload(plugin);
             continue;
          }
 
        if (_ecore_imf_modules_exists(info->id))
          {
-            fprintf(stderr, "** ecore_imf: Error loading input method plugin %s! "
-                            "Plugin with id='%s' already exists!",
-                    filename, info->id);
+            ERR("** ecore_imf: Error loading input method plugin %s! "
+                "Plugin with id='%s' already exists!",
+                filename, info->id);
             ecore_plugin_unload(plugin);
             continue;
          }
@@ -226,9 +226,9 @@ _ecore_imf_module_load_all(void)
        imf_module_create = ecore_plugin_symbol_get(plugin, "imf_module_create");
        if (!imf_module_create)
          {
-            fprintf(stderr, "** ecore_imf: Error setting up input method plugin %s! "
-                            "'imf_module_create' is missing!",
-                    filename);
+            ERR("** ecore_imf: Error setting up input method plugin %s! "
+                "'imf_module_create' is missing!",
+                filename);
             ecore_plugin_unload(plugin);
             continue;
          }
index 123757c..20e8bf4 100644 (file)
@@ -3,6 +3,32 @@
 
 #define ECORE_MAGIC_CONTEXT 0x56c1b39a
 
+extern int _ecore_imf_log_dom;
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_ecore_imf_log_dom, __VA_ARGS__)
+
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_ecore_imf_log_dom, __VA_ARGS__)
+
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_ecore_imf_log_dom, __VA_ARGS__)
+
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_ecore_imf_log_dom, __VA_ARGS__)
+
+#ifdef CRIT
+# undef CRIT
+#endif
+#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_imf_log_dom, __VA_ARGS__)
+
 typedef struct _Ecore_IMF_Module Ecore_IMF_Module;
 
 struct _Ecore_IMF_Context
index 3f41785..6372ea2 100644 (file)
 #include "Evas.h"
 
 
+static int _ecore_input_log_dom = -1;
+
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_ecore_input_log_dom, __VA_ARGS__)
+
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_ecore_input_log_dom, __VA_ARGS__)
+
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_ecore_input_log_dom, __VA_ARGS__)
+
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_ecore_input_log_dom, __VA_ARGS__)
+
+#ifdef CRIT
+# undef CRIT
+#endif
+#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_input_log_dom, __VA_ARGS__)
+
 typedef struct _Ecore_Input_Window Ecore_Input_Window;
 struct _Ecore_Input_Window
 {
@@ -44,7 +71,12 @@ ecore_event_init(void)
 {
    if (++_ecore_event_init_count != 1)
      return _ecore_event_init_count;
-
+   _ecore_input_log_dom = eina_log_domain_register("EcoreInput", ECORE_DEFAULT_LOG_COLOR);
+   if(_ecore_input_log_dom < 0)
+     {
+       EINA_LOG_ERR("Impossible to create a log domain for the ecore input module.");
+       return --_ecore_event_init_count;
+     }
    ECORE_EVENT_KEY_DOWN = ecore_event_type_new();
    ECORE_EVENT_KEY_UP = ecore_event_type_new();
    ECORE_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
@@ -71,7 +103,8 @@ ecore_event_shutdown(void)
    ECORE_EVENT_MOUSE_WHEEL = 0;
    ECORE_EVENT_MOUSE_IN = 0;
    ECORE_EVENT_MOUSE_OUT = 0;
-
+   eina_log_domain_unregister(_ecore_input_log_dom);
+   _ecore_input_log_dom = -1;
    return ++_ecore_event_init_count;
 }
 
index f74fedd..daec531 100644 (file)
@@ -37,6 +37,8 @@
 #define DLT_R1     14
 #define DLT_R2     15
 
+int _ecore_ipc_log_dom = -1;
+
 /* byte swappers - for dealing with big vs little endian machines */
 EAPI unsigned short
 _ecore_ipc_swap_16(unsigned short v)
@@ -263,7 +265,12 @@ ecore_ipc_init(void)
 
    if (++_ecore_ipc_init_count != 1)
      return _ecore_ipc_init_count;
-
+   _ecore_ipc_log_dom = eina_log_domain_register("EcoreIpc", ECORE_DEFAULT_LOG_COLOR);
+   if(_ecore_ipc_log_dom < 0)
+     {
+       EINA_LOG_ERR("Impossible to create a log domain for the Ecore IPC module.");
+       return --_ecore_ipc_init_count;
+     }
    if (!ecore_con_init())
      return --_ecore_ipc_init_count;
 
@@ -309,7 +316,8 @@ ecore_ipc_shutdown(void)
      ecore_event_handler_del(handler[i]);
 
    ecore_con_shutdown();
-
+   eina_log_domain_unregister(_ecore_ipc_log_dom);
+   _ecore_ipc_log_dom = -1;
    return _ecore_ipc_init_count;
 }
 
index 9595975..21aedff 100644 (file)
@@ -2,6 +2,31 @@
 #define _ECORE_IPC_PRIVATE_H
 
 #include "Ecore_Data.h"
+extern int _ecore_ipc_log_dom;
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_ecore_ipc_log_dom, __VA_ARGS__)
+
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_ecore_ipc_log_dom, __VA_ARGS__)
+
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_ecore_ipc_log_dom, __VA_ARGS__)
+
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_ecore_ipc_log_dom, __VA_ARGS__)
+
+#ifdef CRIT
+# undef CRIT
+#endif
+#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_ipc_log_dom, __VA_ARGS__)
 
 #if USE_GNUTLS_OPENSSL
 # include <gnutls/openssl.h>
index 706ee3f..e125be9 100644 (file)
@@ -13,6 +13,7 @@
 #include "ecore_job_private.h"
 #include "Ecore_Job.h"
 
+int _ecore_job_log_dom = -1;
 static int _ecore_job_event_handler(void *data, int type, void *ev);
 static void _ecore_job_event_free(void *data, void *ev);
     
@@ -25,7 +26,12 @@ ecore_job_init(void)
 {
    if (++_ecore_job_init_count != 1)
      return _ecore_job_init_count;
-
+   _ecore_job_log_dom = eina_log_domain_register("EcoreJob", ECORE_DEFAULT_LOG_COLOR);
+   if(_ecore_job_log_dom < 0)
+     {
+       EINA_LOG_ERR("Impossible to create a log domain for the Ecore Job module.");
+       return _ecore_job_init_count--;
+     }
    if (!ecore_init())
      return --_ecore_job_init_count;
 
@@ -43,8 +49,10 @@ ecore_job_shutdown(void)
 
    ecore_event_handler_del(_ecore_job_handler);
    _ecore_job_handler = NULL;
+   eina_log_domain_unregister(_ecore_job_log_dom);
+   _ecore_job_log_dom = -1;
    ecore_shutdown();
-
+   
    return _ecore_job_init_count;
 }
 
index d5795f2..96d0db8 100644 (file)
@@ -3,6 +3,32 @@
 
 #define ECORE_MAGIC_JOB             0x76543210
 
+extern int _ecore_job_log_dom;
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_ecore_job_log_dom, __VA_ARGS__)
+
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_ecore_job_log_dom, __VA_ARGS__)
+
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_ecore_job_log_dom, __VA_ARGS__)
+
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_ecore_job_log_dom, __VA_ARGS__)
+
+#ifdef CRIT
+# undef CRIT
+#endif
+#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_job_log_dom, __VA_ARGS__)
+
 typedef struct _Ecore_Job Ecore_Job;
 
 struct _Ecore_Job
index 115ed57..9c0afcf 100644 (file)
 
 #include <eina_rbtree.h>
 
+static int _ecore_sdl_log_dom = -1;
+
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_ecore_sdl_log_dom, __VA_ARGS__)
+
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_ecore_sdl_log_dom, __VA_ARGS__)
+
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_ecore_sdl_log_dom, __VA_ARGS__)
+
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_ecore_sdl_log_dom, __VA_ARGS__)
+
+#ifdef CRIT
+# undef CRIT
+#endif
+#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_sdl_log_dom, __VA_ARGS__)
+
 typedef struct _Ecore_SDL_Pressed Ecore_SDL_Pressed;
 struct _Ecore_SDL_Pressed
 {
@@ -68,7 +95,12 @@ ecore_sdl_init(const char *name __UNUSED__)
 {
    if(++_ecore_sdl_init_count != 1)
      return _ecore_sdl_init_count;
-
+   _ecore_sdl_log_dom = eina_log_domain_register("EcoreSdl", ECORE_DEFAULT_LOG_COLOR);
+   if(_ecore_sdl_log_dom < 0)
+     {
+       EINA_LOG_ERR("Impossible to create a log domain for the Ecore SDL module.");
+       return --_ecore_sdl_init_count;
+     }
    if (!ecore_event_init())
      return --_ecore_sdl_init_count;
 
@@ -95,7 +127,8 @@ ecore_sdl_shutdown(void)
    return _ecore_sdl_init_count;
 
    ecore_event_shutdown();
-
+   eina_log_domain_unregister(_ecore_sdl_log_dom);
+   _ecore_sdl_log_dom = -1;
    return _ecore_sdl_init_count;
 }
 
index b3e975a..c6dbb36 100644 (file)
@@ -1,4 +1,30 @@
 #ifndef _ECORE_TXT_PRIVATE_H
 #define _ECORE_TXT_PRIVATE_H
 
+extern int _ecore_txt_log_dom;
+
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_ecore_txt_log_dom, __VA_ARGS__)
+
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_ecore_txt_log_dom, __VA_ARGS__)
+
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_ecore_txt_log_dom, __VA_ARGS__)
+
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_ecore_txt_log_dom, __VA_ARGS__)
+
+#ifdef CRIT
+# undef CRIT
+#endif
+#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_txt_log_dom, __VA_ARGS__)
 #endif
index a1003db..65b4503 100644 (file)
@@ -183,6 +183,7 @@ ecore_win32_shutdown()
 
    ecore_event_shutdown();
    eina_log_domain_unregister(_ecore_win32_log_dom_global);
+   _ecore_win32_log_dom_global = -1;
    eina_shutdown();
 
    return _ecore_win32_init_count;
index dc5b3d5..47a1fd1 100644 (file)
@@ -167,6 +167,7 @@ ecore_wince_shutdown()
 
    ecore_event_shutdown();
    eina_log_domain_unregister(_ecore_wince_log_dom_global);
+   _ecore_wince_log_dom_global = -1;
    eina_shutdown();
 
    return _ecore_wince_init_count;
index 0f8c69b..d9c9e45 100644 (file)
@@ -54,6 +54,7 @@ static xcb_generic_event_t *_ecore_xcb_event_buffered = NULL;
 
 static int _ecore_xcb_init_count = 0;
 static int _ecore_xcb_grab_count = 0;
+int _ecore_x11xcb_log_dom = -1;
 
 Ecore_X_Connection *_ecore_xcb_conn = NULL;
 Ecore_X_Screen     *_ecore_xcb_screen = NULL;
@@ -195,11 +196,18 @@ ecore_x_init(const char *name)
 
    if (--_ecore_xcb_init_count != 1)
      return _ecore_xcb_init_count;
-
+   _ecore_x11xcb_log_dom = eina_log_domain_register("EcoreXCB", ECORE_DEFAULT_LOG_COLOR);
+   if(_ecore_x11xcb_log_dom < 0)
+     {
+       EINA_LOG_ERR("Impossible to create a log domain the Ecore XCB module.");
+       return --_ecore_xcb_init_count;
+     }
    _ecore_xcb_conn = xcb_connect(name, &screen);
-   if (!_ecore_xcb_conn)
+   if (!_ecore_xcb_conn) {
+     eina_log_domain_unregister(_ecore_x11xcb_log_dom);
+     _ecore_x11xcb_log_dom = -1;
      return --_ecore_xcb_init_count;
-
+   }
    /* FIXME: no error code right now */
    /* _ecore_xcb_error_handler_init(); */
 
@@ -909,7 +917,7 @@ _ecore_xcb_fd_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
 
    c = (xcb_connection_t *)data;
 
-/*    printf ("nbr events: %d\n", _ecore_xcb_event_handlers_num); */
+/*    INF ("nbr events: %d", _ecore_xcb_event_handlers_num); */
 
    /* We check if _ecore_xcb_event_buffered is NULL or not */
    if (_ecore_xcb_event_buffered)
index da8a14a..8aac26a 100644 (file)
@@ -1592,7 +1592,7 @@ _ecore_x_event_handle_client_message(xcb_generic_event_t *event)
        target->version = ev->data.data32[1] >> 24;
        if (target->version > ECORE_X_DND_VERSION)
          {
-             printf("DND: Requested version %d, we only support up to %d\n", target->version,
+             WRN("DND: Requested version %d, we only support up to %d", target->version,
                     ECORE_X_DND_VERSION);
             return;
          }
@@ -1619,7 +1619,7 @@ _ecore_x_event_handle_client_message(xcb_generic_event_t *event)
                                                        &num_ret);
              if (!format)
               {
-                 printf("DND: Could not fetch data type list from source window, aborting.\n");
+                 ERR("DND: Could not fetch data type list from source window, aborting.");
                  return;
               }
             types = (Ecore_X_Atom *)data;
@@ -1882,7 +1882,7 @@ _ecore_x_event_handle_client_message(xcb_generic_event_t *event)
                         xcb_get_atom_name_name(reply),
                         reply->name_len);
                  name[reply->name_len] = '\0';
-                 printf("Unknown state: %s\n", name);
+                 ERR("Unknown state: %s", name);
                  free(name);
                  free(reply);
                }
@@ -1903,7 +1903,7 @@ _ecore_x_event_handle_client_message(xcb_generic_event_t *event)
                         xcb_get_atom_name_name(reply),
                         reply->name_len);
                  name[reply->name_len] = '\0';
-                 printf("Unknown state: %s\n", name);
+                 WRN("Unknown state: %s", name);
                  free(name);
                }
          }
@@ -2107,7 +2107,7 @@ _ecore_x_event_handle_randr_change(xcb_generic_event_t *event)
 
      if ((!rep) ||
          (((ev->response_type & ~0x80) - rep->first_event) != XCB_RANDR_SCREEN_CHANGE_NOTIFY))
-       printf("ERROR: Can't update RandR config!\n");
+       WRN("ERROR: Can't update RandR config!");
      if (rep)
        free(rep);
      }
index 2f4b6b7..937c629 100644 (file)
@@ -1450,7 +1450,7 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window window __UNUSED__)
    reply = _ecore_xcb_reply_get();
    if (!reply) return NULL;
 
-   printf ("[XCB] reply->bytes_afer (should be 0): %d\n", ((xcb_get_property_reply_t *)reply)->bytes_after);
+   ERR("reply->bytes_afer (should be 0): %d", ((xcb_get_property_reply_t *)reply)->bytes_after);
 
    if (reply->type == ECORE_X_ATOM_UTF8_STRING)
      {
index cc8bbfa..5d12969 100644 (file)
@@ -2776,7 +2776,7 @@ _ecore_x_netwm_startup_info_begin(Ecore_X_Window window,
    if (info)
      {
         exists = 1;
-       printf("Already got info for win: 0x%x\n", window);
+       INF("Already got info for win: 0x%x", window);
        _ecore_x_netwm_startup_info_free(info);
      }
    info = calloc(1, sizeof(Ecore_X_Startup_Info));
@@ -3128,7 +3128,7 @@ _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info,
          }
        else
          {
-            printf("Ecore X Sequence, Unknown: %s=%s\n", key, value);
+            WRN("Ecore X Sequence, Unknown: %s=%s", key, value);
          }
      }
    if (!info->id) return 0;
index b60cf18..172b5da 100644 (file)
 /* FIXME: this is for simulation only */
 #include "Ecore_Txt.h"
 
+static int _ecore_x11xcb_log_dom  -1;
+
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_ecore_x11xcb_log_dom, __VA_ARGS__)
+
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_ecore_x11xcb_log_dom, __VA_ARGS__)
+
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_ecore_x11xcb_log_dom, __VA_ARGS__)
+
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_ecore_x11xcb_log_dom, __VA_ARGS__)
+
+#ifdef CRIT
+# undef CRIT
+#endif
+#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_x11xcb_log_dom, __VA_ARGS__)
+
 typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
 
 struct _Ecore_X_Selection_Intern
index a653d14..df42d61 100644 (file)
@@ -31,6 +31,7 @@ static const int AnyXEvent = 0; /* 0 can be used as there are no event types
 static int _ecore_x_event_shape_id = 0;
 static int _ecore_x_event_screensaver_id = 0;
 static int _ecore_x_event_sync_id = 0;
+int _ecore_xlib_log_dom = -1;
 
 #ifdef ECORE_XRANDR
 static int _ecore_x_event_randr_id = 0;
@@ -168,10 +169,18 @@ ecore_x_init(const char *name)
    
    if (++_ecore_x_init_count != 1) 
      return _ecore_x_init_count;
-
+   _ecore_xlib_log_dom = eina_log_domain_register("EcoreX11", ECORE_DEFAULT_LOG_COLOR);
+   if(_ecore_xlib_log_dom < 0)
+     {
+       EINA_LOG_ERR("Impossible to create a log domain for the Ecore Xlib module.");
+       return --_ecore_x_init_count;
+     }
    if (!ecore_event_init())
-     return --_ecore_x_init_count;
-
+     {
+       eina_log_domain_unregister(_ecore_xlib_log_dom);
+       _ecore_xlib_log_dom = -1;
+       return --_ecore_x_init_count;
+     }
    _ecore_x_disp = XOpenDisplay((char *)name);
    if (!_ecore_x_disp)
      goto shutdown_ecore_event;
@@ -508,7 +517,8 @@ _ecore_x_shutdown(int close_display)
    _ecore_x_dnd_shutdown();
    ecore_x_netwm_shutdown();
    ecore_event_shutdown();
-
+   eina_log_domain_unregister(_ecore_xlib_log_dom);
+   _ecore_xlib_log_dom = -1;
    return _ecore_x_init_count;
 }
 
index 49eccc7..86737fe 100644 (file)
@@ -1421,7 +1421,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent)
        target->version = (int) (xevent->xclient.data.l[1] >> 24);
        if (target->version > ECORE_X_DND_VERSION)
          {
-            printf("DND: Requested version %d, we only support up to %d\n", 
+            WRN("DND: Requested version %d, we only support up to %d", 
                     target->version, ECORE_X_DND_VERSION);
             return;
          }
@@ -1438,7 +1438,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent)
                                                    XA_ATOM,
                                                    32, &data, &num_ret)))
               {
-                 printf("DND: Could not fetch data type list from source window, aborting.\n");
+                 WRN("DND: Could not fetch data type list from source window, aborting.");
                  return;
               }
             types = (Ecore_X_Atom *)data;
@@ -1654,7 +1654,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent)
             char *name;
 
             name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[1]);
-            if (name) printf("Unknown state: %s\n", name);
+            if (name) ERR("Unknown state: %s", name);
             XFree(name);
          }
        e->state[1] = _ecore_x_netwm_state_get(xevent->xclient.data.l[2]);
@@ -1663,7 +1663,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent)
             char *name;
 
             name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[2]);
-            if (name) printf("Unknown state: %s\n", name);
+            if (name) ERR("Unknown state: %s", name);
             XFree(name);
          }
        e->source = xevent->xclient.data.l[3];
@@ -1844,7 +1844,7 @@ _ecore_x_event_handle_randr_change(XEvent *xevent)
    _ecore_x_last_event_mouse_move = 0;
    randr_event = (XRRScreenChangeNotifyEvent *)xevent;
    if (!XRRUpdateConfiguration(xevent))
-     printf("ERROR: Can't update RR config!\n");
+     ERR("Can't update RR config!");
 
    e = calloc(1, sizeof(Ecore_X_Event_Screen_Change));
    if (!e) return;
@@ -1937,8 +1937,8 @@ _ecore_x_event_handle_randr_notify(XEvent *xevent)
         _ecore_x_event_handle_randr_notify_output_property(randr_event);
         break;
       default:
-        fprintf(stderr, "ERROR: unknown XRandR RRNotify subtype: %d.\n",
-                randr_event->subtype);
+        ERR("Unknown XRandR RRNotify subtype: %d.",
+            randr_event->subtype);
         break;
      }
 }
index 277566f..7551101 100644 (file)
@@ -1154,7 +1154,7 @@ _ecore_x_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__, char *data __UN
    if (info)
      {
         exists = 1;
-       printf("Already got info for win: 0x%x\n", win);
+       WRN("Already got info for win: 0x%x", win);
        _ecore_x_netwm_startup_info_free(info);
      }
    info = calloc(1, sizeof(Ecore_X_Startup_Info));
@@ -1478,7 +1478,7 @@ _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, char *data)
          }
        else
          {
-            printf("Ecore X Sequence, Unknown: %s=%s\n", key, value);
+            ERR("Ecore X Sequence, Unknown: %s=%s", key, value);
          }
      }
    if (!info->id) return 0;
index 3d74bdd..6bca511 100644 (file)
 /* FIXME: this is for simulation only */
 #include "Ecore_Txt.h"
 
+extern int _ecore_xlib_log_dom;
+
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_ecore_xlib_log_dom, __VA_ARGS__)
+
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_ecore_xlib_log_dom, __VA_ARGS__)
+
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_ecore_xlib_log_dom, __VA_ARGS__)
+
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_ecore_xlib_log_dom, __VA_ARGS__)
+
+#ifdef CRIT
+# undef CRIT
+#endif
+#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_xlib_log_dom, __VA_ARGS__)
+
 typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
 
 struct _Ecore_X_Selection_Intern
index 5cba091..a873cd2 100644 (file)
@@ -152,7 +152,7 @@ ecore_x_randr_current_screen_size_get(Ecore_X_Window root)
    sc = XRRGetScreenInfo(_ecore_x_disp, root);
    if (!sc)
      {
-       printf("ERROR: Couldn't get screen information for %d\n", root);
+       ERR("Couldn't get screen information for %d", root);
        return ret;
      }
    size_index = XRRConfigCurrentConfiguration(sc, &rotation);
@@ -192,7 +192,7 @@ ecore_x_randr_screen_size_set(Ecore_X_Window root, Ecore_X_Screen_Size size)
                          root, size_index,
                          RR_Rotate_0, CurrentTime))
      {
-       printf("ERROR: Can't set new screen size!\n");
+       ERR("Can't set new screen size!");
        XRRFreeScreenConfigInfo(sc);
        return 0;
      }
@@ -213,7 +213,7 @@ ecore_x_randr_current_screen_refresh_rate_get(Ecore_X_Window root)
    sc = XRRGetScreenInfo(_ecore_x_disp, root);
    if (!sc)
      {
-       printf("ERROR: Couldn't get screen information for %d\n", root);
+       ERR("Couldn't get screen information for %d", root);
        return ret;
      }
    ret.rate = XRRConfigCurrentRate(sc);
@@ -236,7 +236,7 @@ ecore_x_randr_screen_refresh_rates_get(Ecore_X_Window root, int size_id, int *nu
    sc = XRRGetScreenInfo(_ecore_x_disp, root);
    if (!sc)
      {
-       printf("ERROR: Couldn't get screen information for %d\n", root);
+       ERR("Couldn't get screen information for %d", root);
        return ret;
      }
    
@@ -285,7 +285,7 @@ ecore_x_randr_screen_refresh_rate_set(Ecore_X_Window root, Ecore_X_Screen_Size s
                                 root, size_index,
                                 RR_Rotate_0, rate.rate, CurrentTime))
      {
-       printf("ERROR: Can't set new screen size and refresh rate!\n");
+       ERR("Can't set new screen size and refresh rate!");
        XRRFreeScreenConfigInfo(sc);
        return 0;
      }