forked from enlightenment/efl
eina_log: CONVENTION BREAK!!!! automatically adds \n
Automatically add \n to messages. Since we use that prefix, there is no use to allow messages without \n, it would look a mess. Some logging systems may not require the trailing newline, for example logging to xml or syslog, for those you don't need to ignore this char if present. Yes, this breaks convention, but better now than latter. And the results are not so bad. SVN revision: 42200
This commit is contained in:
parent
8024360138
commit
cee03dcb3c
|
@ -1001,6 +1001,7 @@ eina_log_print_cb_stderr(const Eina_Log_Domain *d, Eina_Log_Level level,
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
vfprintf(stderr, fmt, args);
|
vfprintf(stderr, fmt, args);
|
||||||
|
putc('\n', stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1079,6 +1080,7 @@ eina_log_print_cb_stdout(const Eina_Log_Domain *d, Eina_Log_Level level,
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
vprintf(fmt, args);
|
vprintf(fmt, args);
|
||||||
|
putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1110,6 +1112,7 @@ eina_log_print_cb_file(const Eina_Log_Domain *d, __UNUSED__ Eina_Log_Level level
|
||||||
fprintf(f, "%s %s:%d %s() ", d->name, file, line, fnc);
|
fprintf(f, "%s %s:%d %s() ", d->name, file, line, fnc);
|
||||||
end:
|
end:
|
||||||
vfprintf(f, fmt, args);
|
vfprintf(f, fmt, args);
|
||||||
|
putc('\n', f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -1159,7 +1162,8 @@ eina_log_print_unlocked(int domain, Eina_Log_Level level, const char *file, cons
|
||||||
* @param file filename that originated the call, must @b not be @c NULL.
|
* @param file filename that originated the call, must @b not be @c NULL.
|
||||||
* @param fnc function that originated the call, must @b not be @c NULL.
|
* @param fnc function that originated the call, must @b not be @c NULL.
|
||||||
* @param line originating line in @a file.
|
* @param line originating line in @a file.
|
||||||
* @param fmt printf-like format to use.
|
* @param fmt printf-like format to use. Should not provide trailing
|
||||||
|
* '\n' as it is automatically included.
|
||||||
*
|
*
|
||||||
* @note MT: this function may be called from different threads if
|
* @note MT: this function may be called from different threads if
|
||||||
* eina_log_threads_enable() was called before.
|
* eina_log_threads_enable() was called before.
|
||||||
|
|
|
@ -219,14 +219,14 @@ eina_module_init(void)
|
||||||
("eina_module", EINA_LOG_COLOR_DEFAULT);
|
("eina_module", EINA_LOG_COLOR_DEFAULT);
|
||||||
if (EINA_MODULE_LOG_DOM < 0)
|
if (EINA_MODULE_LOG_DOM < 0)
|
||||||
{
|
{
|
||||||
EINA_LOG_ERR("Could not register log domain: eina_module\n");
|
EINA_LOG_ERR("Could not register log domain: eina_module");
|
||||||
eina_log_shutdown();
|
eina_log_shutdown();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eina_error_init())
|
if (!eina_error_init())
|
||||||
{
|
{
|
||||||
ERR("Could not initialize eina error module.\n");
|
ERR("Could not initialize eina error module.");
|
||||||
eina_log_shutdown();
|
eina_log_shutdown();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -301,13 +301,13 @@ EAPI Eina_Module *eina_module_new(const char *file)
|
||||||
|
|
||||||
m = malloc(sizeof(Eina_Module) + len + 1);
|
m = malloc(sizeof(Eina_Module) + len + 1);
|
||||||
if (!m) {
|
if (!m) {
|
||||||
ERR("could not malloc(%lu)\n", sizeof(Eina_Module) + len + 1);
|
ERR("could not malloc(%lu)", sizeof(Eina_Module) + len + 1);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memcpy((char *)m->file, file, len + 1);
|
memcpy((char *)m->file, file, len + 1);
|
||||||
m->ref = 0;
|
m->ref = 0;
|
||||||
m->handle = NULL;
|
m->handle = NULL;
|
||||||
DBG("m=%p, file=%s\n", m, file);
|
DBG("m=%p, file=%s", m, file);
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ EAPI Eina_Bool eina_module_free(Eina_Module *m)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(m, EINA_FALSE);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(m, EINA_FALSE);
|
||||||
|
|
||||||
DBG("m=%p, handle=%p, file=%s, refs=%d\n", m, m->handle, m->file, m->ref);
|
DBG("m=%p, handle=%p, file=%s, refs=%d", m, m->handle, m->file, m->ref);
|
||||||
|
|
||||||
if (m->handle)
|
if (m->handle)
|
||||||
{
|
{
|
||||||
|
@ -365,14 +365,14 @@ EAPI Eina_Bool eina_module_load(Eina_Module *m)
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(m, EINA_FALSE);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(m, EINA_FALSE);
|
||||||
|
|
||||||
DBG("m=%p, handle=%p, file=%s, refs=%d\n", m, m->handle, m->file, m->ref);
|
DBG("m=%p, handle=%p, file=%s, refs=%d", m, m->handle, m->file, m->ref);
|
||||||
|
|
||||||
if (m->handle) goto loaded;
|
if (m->handle) goto loaded;
|
||||||
|
|
||||||
dl_handle = dlopen(m->file, RTLD_NOW);
|
dl_handle = dlopen(m->file, RTLD_NOW);
|
||||||
if (!dl_handle)
|
if (!dl_handle)
|
||||||
{
|
{
|
||||||
WRN("could not dlopen(\"%s\", RTLD_NOW): %s\n", m->file, dlerror());
|
WRN("could not dlopen(\"%s\", RTLD_NOW): %s", m->file, dlerror());
|
||||||
eina_error_set(EINA_ERROR_WRONG_MODULE);
|
eina_error_set(EINA_ERROR_WRONG_MODULE);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -383,7 +383,7 @@ EAPI Eina_Bool eina_module_load(Eina_Module *m)
|
||||||
if ((*initcall)() == EINA_TRUE)
|
if ((*initcall)() == EINA_TRUE)
|
||||||
goto ok;
|
goto ok;
|
||||||
|
|
||||||
WRN("could not find eina's entry symbol %s inside module %s\n",
|
WRN("could not find eina's entry symbol %s inside module %s",
|
||||||
EINA_MODULE_SYMBOL_INIT, m->file);
|
EINA_MODULE_SYMBOL_INIT, m->file);
|
||||||
eina_error_set(EINA_ERROR_MODULE_INIT_FAILED);
|
eina_error_set(EINA_ERROR_MODULE_INIT_FAILED);
|
||||||
dlclose(dl_handle);
|
dlclose(dl_handle);
|
||||||
|
@ -418,7 +418,7 @@ EAPI Eina_Bool eina_module_unload(Eina_Module *m)
|
||||||
Eina_Module_Shutdown *shut;
|
Eina_Module_Shutdown *shut;
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(m, EINA_FALSE);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(m, EINA_FALSE);
|
||||||
|
|
||||||
DBG("m=%p, handle=%p, file=%s, refs=%d\n", m, m->handle, m->file, m->ref);
|
DBG("m=%p, handle=%p, file=%s, refs=%d", m, m->handle, m->file, m->ref);
|
||||||
|
|
||||||
m->ref--;
|
m->ref--;
|
||||||
if (!m->ref)
|
if (!m->ref)
|
||||||
|
@ -428,7 +428,7 @@ EAPI Eina_Bool eina_module_unload(Eina_Module *m)
|
||||||
(*shut)();
|
(*shut)();
|
||||||
dlclose(m->handle);
|
dlclose(m->handle);
|
||||||
m->handle = NULL;
|
m->handle = NULL;
|
||||||
DBG("unloaded module %s\n", m->file);
|
DBG("unloaded module %s", m->file);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
@ -577,7 +577,7 @@ EAPI void eina_module_list_load(Eina_Array *array)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(array);
|
EINA_SAFETY_ON_NULL_RETURN(array);
|
||||||
DBG("array %p, count %u\n", array, array->count);
|
DBG("array %p, count %u", array, array->count);
|
||||||
EINA_ARRAY_ITER_NEXT(array, i, m, iterator)
|
EINA_ARRAY_ITER_NEXT(array, i, m, iterator)
|
||||||
eina_module_load(m);
|
eina_module_load(m);
|
||||||
}
|
}
|
||||||
|
@ -593,7 +593,7 @@ EAPI void eina_module_list_unload(Eina_Array *array)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(array);
|
EINA_SAFETY_ON_NULL_RETURN(array);
|
||||||
DBG("array %p, count %u\n", array, array->count);
|
DBG("array %p, count %u", array, array->count);
|
||||||
EINA_ARRAY_ITER_NEXT(array, i, m, iterator)
|
EINA_ARRAY_ITER_NEXT(array, i, m, iterator)
|
||||||
eina_module_unload(m);
|
eina_module_unload(m);
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,7 @@ EAPI void eina_module_list_flush(Eina_Array *array)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(array);
|
EINA_SAFETY_ON_NULL_RETURN(array);
|
||||||
DBG("array %p, count %u\n", array, array->count);
|
DBG("array %p, count %u", array, array->count);
|
||||||
EINA_ARRAY_ITER_NEXT(array, i, m, iterator)
|
EINA_ARRAY_ITER_NEXT(array, i, m, iterator)
|
||||||
eina_module_free(m);
|
eina_module_free(m);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue