[asterisk-commits] kpfleming: trunk r264160 - in /trunk: configs/logger.conf.sample main/logger.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 19 10:29:31 CDT 2010


Author: kpfleming
Date: Wed May 19 10:29:28 2010
New Revision: 264160

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=264160
Log:
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/


Modified:
    trunk/configs/logger.conf.sample
    trunk/main/logger.c

Modified: trunk/configs/logger.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/logger.conf.sample?view=diff&rev=264160&r1=264159&r2=264160
==============================================================================
--- trunk/configs/logger.conf.sample (original)
+++ trunk/configs/logger.conf.sample Wed May 19 10:29:28 2010
@@ -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

Modified: trunk/main/logger.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/logger.c?view=diff&rev=264160&r1=264159&r2=264160
==============================================================================
--- trunk/main/logger.c (original)
+++ trunk/main/logger.c Wed May 19 10:29:28 2010
@@ -214,14 +214,14 @@
 	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;
 			}
 		}




More information about the asterisk-commits mailing list