[Freeswitch-svn] [commit] r11023 - in freeswitch/trunk/libs/esl: . src src/include

FreeSWITCH SVN anthm at freeswitch.org
Wed Dec 31 08:52:11 PST 2008


Author: anthm
Date: Wed Dec 31 11:52:11 2008
New Revision: 11023

Log:
cleanup debug handling

Modified:
   freeswitch/trunk/libs/esl/fs_cli.c
   freeswitch/trunk/libs/esl/src/esl.c
   freeswitch/trunk/libs/esl/src/include/esl.h
   freeswitch/trunk/libs/esl/testclient.c
   freeswitch/trunk/libs/esl/testserver.c

Modified: freeswitch/trunk/libs/esl/fs_cli.c
==============================================================================
--- freeswitch/trunk/libs/esl/fs_cli.c	(original)
+++ freeswitch/trunk/libs/esl/fs_cli.c	Wed Dec 31 11:52:11 2008
@@ -107,6 +107,13 @@
 					} else if (!strcasecmp(type, "text/disconnect-notice")) {
 						running = thread_running = 0;
 						known++;
+					} else if (!strcasecmp(type, "text/event-plain")) {
+						char *foo;
+						esl_event_serialize(handle->last_ievent, &foo, ESL_FALSE);
+						printf("RECV EVENT\n%s\n", foo);
+						free(foo);
+
+						known++;
 					}
 				}
 				
@@ -313,7 +320,6 @@
 	
 	signal(SIGINT, handle_SIGINT);
 
-	handle.debug = 0;
 	esl_global_set_default_logger(6); /* default debug level to 6 (info) */
 	
 	for(;;) {

Modified: freeswitch/trunk/libs/esl/src/esl.c
==============================================================================
--- freeswitch/trunk/libs/esl/src/esl.c	(original)
+++ freeswitch/trunk/libs/esl/src/esl.c	Wed Dec 31 11:52:11 2008
@@ -370,10 +370,8 @@
 
 	esl_event_serialize(handle->last_ievent, &txt, ESL_TRUE);
 
-	if (handle->debug) {
-		esl_log(ESL_LOG_DEBUG, "SEND EVENT\n%s\n", txt);
-	}
-	
+	esl_log(ESL_LOG_DEBUG, "SEND EVENT\n%s\n", txt);
+		
 	send(handle->sock, "sendevent\n", 10, 0);
 	send(handle->sock, txt, strlen(txt), 0);
 	send(handle->sock, "\n\n", 2, 0);
@@ -699,9 +697,7 @@
 				
 				if (hname && hval) {
 					esl_url_decode(hval);
-					if (handle->debug > 1) {
-						esl_log(ESL_LOG_DEBUG, "RECV HEADER [%s] = [%s]\n", hname, hval);
-					}
+					esl_log(ESL_LOG_DEBUG, "RECV HEADER [%s] = [%s]\n", hname, hval);
 					esl_event_add_header_string(revent, ESL_STACK_BOTTOM, hname, hval);
 				}
 
@@ -793,10 +789,7 @@
 			
 				if (hname && hval) {
 					esl_url_decode(hval);
-
-					if (handle->debug > 1) {
-						esl_log(ESL_LOG_DEBUG, "RECV INNER HEADER [%s] = [%s]\n", hname, hval);
-					}
+					esl_log(ESL_LOG_DEBUG, "RECV INNER HEADER [%s] = [%s]\n", hname, hval);
 					esl_event_add_header_string(handle->last_ievent, ESL_STACK_BOTTOM, hname, hval);
 				}
 				
@@ -825,8 +818,8 @@
 				handle->last_ievent->body = body;
 			}
 
-
-			if (handle->debug) {
+			
+			if (esl_log_level >= 7) {
 				char *foo;
 				esl_event_serialize(handle->last_ievent, &foo, ESL_FALSE);
 				esl_log(ESL_LOG_DEBUG, "RECV EVENT\n%s\n", foo);
@@ -834,7 +827,7 @@
 			}
 		}
 		
-		if (handle->debug) {
+		if (esl_log_level >= 7) {
 			char *foo;
 			esl_event_serialize(revent, &foo, ESL_FALSE);
 			esl_log(ESL_LOG_DEBUG, "RECV MESSAGE\n%s\n", foo);
@@ -857,9 +850,7 @@
 {
 	const char *e = cmd + strlen(cmd) -1;
 	
-	if (handle->debug) {
-		esl_log(ESL_LOG_DEBUG, "SEND\n%s\n", cmd);
-	}
+	esl_log(ESL_LOG_DEBUG, "SEND\n%s\n", cmd);
 	
 	if (send(handle->sock, cmd, strlen(cmd), 0) != (int)strlen(cmd)) {
 		strerror_r(handle->errnum, handle->err, sizeof(handle->err));

Modified: freeswitch/trunk/libs/esl/src/include/esl.h
==============================================================================
--- freeswitch/trunk/libs/esl/src/include/esl.h	(original)
+++ freeswitch/trunk/libs/esl/src/include/esl.h	Wed Dec 31 11:52:11 2008
@@ -256,7 +256,6 @@
 	esl_event_t *last_sr_event;
 	esl_event_t *last_ievent;
 	esl_event_t *info_event;
-	int debug;
 	int connected;
 	struct sockaddr_in addr;
 	esl_mutex_t *mutex;

Modified: freeswitch/trunk/libs/esl/testclient.c
==============================================================================
--- freeswitch/trunk/libs/esl/testclient.c	(original)
+++ freeswitch/trunk/libs/esl/testclient.c	Wed Dec 31 11:52:11 2008
@@ -7,8 +7,6 @@
 {
 	esl_handle_t handle = {{0}};
 
-	handle.debug = 1;
-	
 	esl_connect(&handle, "localhost", 8021, "ClueCon");
 
 	esl_send_recv(&handle, "api status\n\n");

Modified: freeswitch/trunk/libs/esl/testserver.c
==============================================================================
--- freeswitch/trunk/libs/esl/testserver.c	(original)
+++ freeswitch/trunk/libs/esl/testserver.c	Wed Dec 31 11:52:11 2008
@@ -13,7 +13,6 @@
 
 
 	esl_attach_handle(&handle, client_sock, addr);
-	handle.debug = 2;
 
 	printf("Connected! %d\n", handle.sock);
 	



More information about the Freeswitch-svn mailing list