summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndy Williams <andy@andywillias.me>2014-02-26 03:59:41 +0000
committerAndy Williams <andy@andywillias.me>2014-02-26 04:02:33 +0000
commit5913ce7ec87beb267d2d02846e5267eae08ef860 (patch)
tree02e606e992f66f1d00543cda4e77531484939aa2 /src
parent47955c302a9d70d54ee3db0b32b1223539df12d3 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/lib/eina/eina_log.c18
-rw-r--r--src/lib/eina/eina_log.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/eina/eina_log.c b/src/lib/eina/eina_log.c
index 46494d6d5f..e225e345b8 100644
--- a/src/lib/eina/eina_log.c
+++ b/src/lib/eina/eina_log.c
@@ -920,6 +920,7 @@ eina_log_domain_new(Eina_Log_Domain *d, Eina_Log_Timing *t,
920 EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL); 920 EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
921 921
922 d->level = EINA_LOG_LEVEL_UNKNOWN; 922 d->level = EINA_LOG_LEVEL_UNKNOWN;
923 d->color = color;
923 d->deleted = EINA_FALSE; 924 d->deleted = EINA_FALSE;
924 925
925 if ((color) && (!_disable_color)) 926 if ((color) && (!_disable_color))
@@ -1581,7 +1582,24 @@ EAPI void
1581eina_log_color_disable_set(Eina_Bool disabled) 1582eina_log_color_disable_set(Eina_Bool disabled)
1582{ 1583{
1583#ifdef EINA_ENABLE_LOG 1584#ifdef EINA_ENABLE_LOG
1585 Eina_Log_Domain *domain;
1586 unsigned int i;
1587
1584 _disable_color = disabled; 1588 _disable_color = disabled;
1589
1590 for (i = 0; i < _log_domains_count; i++)
1591 {
1592 domain = &_log_domains[i];
1593
1594 if (domain->domain_str)
1595 free((char *)domain->domain_str);
1596
1597 if ((domain->color) && (!_disable_color))
1598 domain->domain_str = eina_log_domain_str_get(domain->name, domain->color);
1599 else
1600 domain->domain_str = eina_log_domain_str_get(domain->name, NULL);
1601 }
1602
1585#else 1603#else
1586 (void) disabled; 1604 (void) disabled;
1587#endif 1605#endif
diff --git a/src/lib/eina/eina_log.h b/src/lib/eina/eina_log.h
index feb1b2ef3f..bc59d785e8 100644
--- a/src/lib/eina/eina_log.h
+++ b/src/lib/eina/eina_log.h
@@ -413,6 +413,7 @@ typedef struct _Eina_Log_Domain Eina_Log_Domain;
413struct _Eina_Log_Domain 413struct _Eina_Log_Domain
414{ 414{
415 int level; /**< Max level to log */ 415 int level; /**< Max level to log */
416 const char *color; /**< Color to use when printing in this domain */
416 const char *domain_str; /**< Formatted string with color to print */ 417 const char *domain_str; /**< Formatted string with color to print */
417 const char *name; /**< Domain name */ 418 const char *name; /**< Domain name */
418 size_t namelen; /**< strlen(name) */ 419 size_t namelen; /**< strlen(name) */