* ecore: Use eina_log.

Patch from Mathieu Taillefumier.


SVN revision: 44637
This commit is contained in:
Cedric BAIL 2009-12-21 17:32:19 +00:00
parent 2410d1f00a
commit d8e1895350
50 changed files with 698 additions and 275 deletions

View 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

View 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();
}

View 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)

View 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;
}

View 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);
}

View 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;
}

View 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

View File

@ -23,6 +23,41 @@
# 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

View 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;

View 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;

View 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();
}

View 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;
}
}

View File

@ -23,6 +23,32 @@
#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,

View 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;
}

View 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;
}

View 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)

View 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;
}
}

View 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;