Re: [PATCH] log: allow disabling certain logs
Hi On 06/10/2014 09:47 AM, Patrik Flykt wrote: > > Hi, > > On Fri, 2014-06-06 at 12:26 +0300, Slava Monich wrote: >> Log patterns prefixed with ! disable the logging. That makes it >> possible to enable logs everywhere except for the specific files >> which don't interest the person doing the debugging. > > The README file documents how to activate debugging only for a subset of > source code files. What is the reason behind enabling all debug > information and then suppressing a part of it? I would love to have something like this: -d * !dnsproxy for example. > Notice that we do want to have the same logic across related projects > like oFono, Bluez and neard. This patch can easily ported to all projects. cheers, daniel ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
Re: [PATCH] log: allow disabling certain logs
Hi, On Fri, 2014-06-06 at 12:26 +0300, Slava Monich wrote: > Log patterns prefixed with ! disable the logging. That makes it > possible to enable logs everywhere except for the specific files > which don't interest the person doing the debugging. The README file documents how to activate debugging only for a subset of source code files. What is the reason behind enabling all debug information and then suppressing a part of it? Notice that we do want to have the same logic across related projects like oFono, Bluez and neard. Cheers, Patrik ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
[PATCH] log: allow disabling certain logs
Log patterns prefixed with ! disable the logging. That makes it possible to enable logs everywhere except for the specific files which don't interest the person doing the debugging. --- src/log.c | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/log.c b/src/log.c index a693bd0..18eb363 100644 --- a/src/log.c +++ b/src/log.c @@ -246,20 +246,30 @@ static gchar **enabled = NULL; static bool is_enabled(struct connman_debug_desc *desc) { int i; + gboolean ret = false; if (!enabled) return false; for (i = 0; enabled[i]; i++) { - if (desc->name && g_pattern_match_simple(enabled[i], + const char* pattern = enabled[i]; + gboolean value = true; + + if (pattern[0] == '!') { + pattern++; + value = false; + } + + if (desc->name && g_pattern_match_simple(pattern, desc->name)) - return true; - if (desc->file && g_pattern_match_simple(enabled[i], + ret = value; + if (desc->file && g_pattern_match_simple(pattern, desc->file)) - return true; + ret = value; } - return false; + /* Return the last seen value */ + return ret; } void __connman_log_enable(struct connman_debug_desc *start, -- 1.8.3.2 ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman