[asterisk-commits] junky: branch junky/cli-tls r205658 - /team/junky/cli-tls/main/logger.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 9 12:41:52 CDT 2009


Author: junky
Date: Thu Jul  9 12:41:48 2009
New Revision: 205658

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205658
Log:
yay! 
first alpha version works for ast_log() and ast_verbose()


Modified:
    team/junky/cli-tls/main/logger.c

Modified: team/junky/cli-tls/main/logger.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/junky/cli-tls/main/logger.c?view=diff&rev=205658&r1=205657&r2=205658
==============================================================================
--- team/junky/cli-tls/main/logger.c (original)
+++ team/junky/cli-tls/main/logger.c Thu Jul  9 12:41:48 2009
@@ -1143,7 +1143,7 @@
 	char datestring[256];
 	struct logger_filter_list_item *filter;
 	struct ast_cli_filter *c;
-	int skip=1;
+	int skip=0;
 
 
 	if (!(buf = ast_str_thread_get(&log_buf, LOG_BUF_INIT_SIZE)))
@@ -1196,6 +1196,7 @@
 
 					if (strncmp(filter->chan->name, c->name, strlen(c->name))) {	
 						printf("Ignore %s, since this is not in filter list\n", filter->chan->name);
+						skip=1;
 					//	break; //no break to traverse the list of cli filters 
 					} else {
 						printf("%s match my filter, so continue\n", filter->chan->name);
@@ -1210,8 +1211,8 @@
 	}
 
 	if (skip) {
-		//return;	
 		printf("skip!\n");
+		return;
 	} else {
 		printf("No skip!\n");
 	}
@@ -1332,6 +1333,10 @@
 	struct logmsg *logmsg = NULL;
 	struct ast_str *buf = NULL;
 	int res = 0;
+	struct logger_filter_list_item *filter;
+        struct ast_cli_filter *c;
+        int skip=0;
+
 
 	if (!(buf = ast_str_thread_get(&verbose_buf, VERBOSE_BUF_INIT_SIZE)))
 		return;
@@ -1370,6 +1375,44 @@
 
 	/* Set type */
 	logmsg->type = LOGMSG_VERBOSE;
+
+        if ((channels = ast_threadstorage_get(&filter_channels, sizeof(*channels)))) {
+                printf("chan is there!!!!!\n");
+
+                AST_LIST_TRAVERSE_SAFE_BEGIN(channels, filter, next) {
+                        printf("filter!!!\n");
+                        if (filter->chan) {
+                               printf("chan is %s\n", filter->chan->name);
+                                AST_LIST_TRAVERSE(&ast_cli_filters, c, filter_list) {
+                                        printf("active cli filter:%s\n",c->name);
+
+                                        if (strncmp(filter->chan->name, c->name, strlen(c->name))) {
+                                                printf("Ignore %s, since this is not in filter list\n", filter->chan->name);
+                                                skip=1;
+                                        //      break; //no break to traverse the list of cli filters
+                                        } else {
+                                                printf("%s match my filter, so continue\n", filter->chan->name);
+                                                skip=0;
+                                                break;
+                                        }
+                                }
+                        }
+                }
+                AST_LIST_TRAVERSE_SAFE_END;
+
+        }
+
+        if (skip) {
+                printf("skip!\n");
+                return;
+        } else {
+                printf("No skip!\n");
+        }
+
+
+
+
+
 	
 	/* Add to the list and poke the thread if possible */
 	if (logthread != AST_PTHREADT_NULL) {




More information about the asterisk-commits mailing list