From e77efbc12e4ed62423a3c93db9d55e0346cf059c Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Wed, 19 May 2010 15:29:28 +0000 Subject: [PATCH] Add ability for logger channels to include *all* levels. Now that Asterisk modules can dynamically create and destroy logger levels on demand, it's useful to be able to configure a logger channel (console, file, whatever) to be able to accept log messages from *all* levels, even levels created dynamically. This patch adds support for this, by allowing the '*' level name to be used in logger.conf. Review: https://reviewboard.asterisk.org/r/663/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264160 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- configs/logger.conf.sample | 9 +++++++++ main/logger.c | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/configs/logger.conf.sample b/configs/logger.conf.sample index c9e9890a7a..75e10e46aa 100644 --- a/configs/logger.conf.sample +++ b/configs/logger.conf.sample @@ -73,6 +73,15 @@ ; (see 'astlogdir' in asterisk.conf), or absolute paths that begin with ; '/'. ; +; Special level name "*" means all levels, even dynamic levels registered +; by modules after the logger has been initialized (this means that loading +; and unloading modules that create/remove dynamic logger levels will result +; in these levels being included on filenames that have a level name of "*", +; without any need to perform a 'logger reload' or similar operation). Note +; that there is no value in specifying both "*" and specific level names for +; a filename; the "*" level means all levels, and the remaining level names +; will be ignored. +; ; We highly recommend that you DO NOT turn on debug mode if you are simply ; running a production system. Debug mode turns on a LOT of extra messages, ; most of which you are unlikely to understand without an understanding of diff --git a/main/logger.c b/main/logger.c index 0038c5f449..3b66854a15 100644 --- a/main/logger.c +++ b/main/logger.c @@ -214,14 +214,14 @@ static unsigned int make_components(const char *s, int lineno) unsigned int x; while ((w = strsep(&stringp, ","))) { - int found = 0; - w = ast_skip_blanks(w); - for (x = 0; x < ARRAY_LEN(levels); x++) { + if (!strcmp(w, "*")) { + res = 0xFFFF; + break; + } else for (x = 0; x < ARRAY_LEN(levels); x++) { if (levels[x] && !strcasecmp(w, levels[x])) { res |= (1 << x); - found = 1; break; } }