eina_log: Update domain colouring when color_disable_set is called

After color_disable is set we should update the domain_str for each domain
as this cached the setting from when the domain was registered.
This required storing the colour within the domain for later use.
Fixes T1029
This commit is contained in:
Andy Williams 2014-02-26 03:59:41 +00:00
parent 47955c302a
commit 5913ce7ec8
3 changed files with 20 additions and 0 deletions

1
NEWS
View File

@ -429,6 +429,7 @@ Fixes:
* textgrid - with new fallback fonts we cant depend on glyph extents anymore
* textgrid - out-of-bounds chars cause update artifacts - fix.
* Emotion test: fix calculation of the displayed time.
* eina: Update domain output if eina_log_color_disable_set is called after a domain is registered (T1029).
Removals:

View File

@ -920,6 +920,7 @@ eina_log_domain_new(Eina_Log_Domain *d, Eina_Log_Timing *t,
EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
d->level = EINA_LOG_LEVEL_UNKNOWN;
d->color = color;
d->deleted = EINA_FALSE;
if ((color) && (!_disable_color))
@ -1581,7 +1582,24 @@ EAPI void
eina_log_color_disable_set(Eina_Bool disabled)
{
#ifdef EINA_ENABLE_LOG
Eina_Log_Domain *domain;
unsigned int i;
_disable_color = disabled;
for (i = 0; i < _log_domains_count; i++)
{
domain = &_log_domains[i];
if (domain->domain_str)
free((char *)domain->domain_str);
if ((domain->color) && (!_disable_color))
domain->domain_str = eina_log_domain_str_get(domain->name, domain->color);
else
domain->domain_str = eina_log_domain_str_get(domain->name, NULL);
}
#else
(void) disabled;
#endif

View File

@ -413,6 +413,7 @@ typedef struct _Eina_Log_Domain Eina_Log_Domain;
struct _Eina_Log_Domain
{
int level; /**< Max level to log */
const char *color; /**< Color to use when printing in this domain */
const char *domain_str; /**< Formatted string with color to print */
const char *name; /**< Domain name */
size_t namelen; /**< strlen(name) */