aboutsummaryrefslogtreecommitdiffstats
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 06:48:12 +0000
commit85c9084856667104ffe212d9cb468a5375ba2ae8 (patch)
treec648b193c5bb9f8127e8e6ad8a32a8b79708ddd1 /src
parentedje/entry: fix to not emit "changed" signal in unnecessary cases of password... (diff)
downloadefl-85c9084856667104ffe212d9cb468a5375ba2ae8.tar.gz
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 https://phab.enlightenment.org/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,
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
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;
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) */