[asterisk-addons-commits] file: branch 1.4 r439 - /branches/1.4/cdr_addon_mysql.c

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Thu Sep 6 10:31:02 CDT 2007


Author: file
Date: Thu Sep  6 10:31:01 2007
New Revision: 439

URL: http://svn.digium.com/view/asterisk-addons?view=rev&rev=439
Log:
(closes issue #10657)
Reported by: casper
Patches:
      cdr_addon_mysql.c.438.diff uploaded by casper (license 55)
Don't log debug messages if debug is not enabled.

Modified:
    branches/1.4/cdr_addon_mysql.c

Modified: branches/1.4/cdr_addon_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/branches/1.4/cdr_addon_mysql.c?view=diff&rev=439&r1=438&r2=439
==============================================================================
--- branches/1.4/cdr_addon_mysql.c (original)
+++ branches/1.4/cdr_addon_mysql.c Thu Sep  6 10:31:01 2007
@@ -207,7 +207,8 @@
 		return -1;
 	}
 
-	ast_log(LOG_DEBUG, "cdr_mysql: inserting a CDR record.\n");
+	if (option_debug)
+		ast_log(LOG_DEBUG, "cdr_mysql: inserting a CDR record.\n");
 
 	if (userfield && userfielddata) {
 #ifdef MYSQL_LOGUNIQUEID
@@ -223,7 +224,8 @@
 #endif
 	}
 	
-	ast_log(LOG_DEBUG, "cdr_mysql: SQL command as follows: %s\n", sqlcmd);
+	if (option_debug)
+		ast_log(LOG_DEBUG, "cdr_mysql: SQL command as follows: %s\n", sqlcmd);
 	
 	if (connected) {
 		if (mysql_real_query(&mysql, sqlcmd, strlen(sqlcmd))) {
@@ -417,15 +419,17 @@
 	
 	ast_config_destroy(cfg);
 
-	ast_log(LOG_DEBUG, "cdr_mysql: got hostname of %s\n", hostname);
-	ast_log(LOG_DEBUG, "cdr_mysql: got port of %d\n", dbport);
-	ast_log(LOG_DEBUG, "cdr_mysql: got a timeout of %d\n", timeout);
-	if (dbsock)
-		ast_log(LOG_DEBUG, "cdr_mysql: got sock file of %s\n", dbsock);
-	ast_log(LOG_DEBUG, "cdr_mysql: got user of %s\n", dbuser);
-	ast_log(LOG_DEBUG, "cdr_mysql: got dbname of %s\n", dbname);
-	ast_log(LOG_DEBUG, "cdr_mysql: got password of %s\n", password);
-
+	if (option_debug) {
+		ast_log(LOG_DEBUG, "cdr_mysql: got hostname of %s\n", hostname);
+		ast_log(LOG_DEBUG, "cdr_mysql: got port of %d\n", dbport);
+		ast_log(LOG_DEBUG, "cdr_mysql: got a timeout of %d\n", timeout);
+		if (dbsock)
+			ast_log(LOG_DEBUG, "cdr_mysql: got sock file of %s\n", dbsock);
+		ast_log(LOG_DEBUG, "cdr_mysql: got user of %s\n", dbuser);
+		ast_log(LOG_DEBUG, "cdr_mysql: got dbname of %s\n", dbname);
+		ast_log(LOG_DEBUG, "cdr_mysql: got password of %s\n", password);
+	}
+	
 	mysql_init(&mysql);
 
 	if (timeout && mysql_options(&mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *)&timeout)!=0) {
@@ -437,7 +441,8 @@
 		connected = 0;
 		records = 0;
 	} else {
-		ast_log(LOG_DEBUG, "Successfully connected to MySQL database.\n");
+		if (option_debug)
+			ast_log(LOG_DEBUG, "Successfully connected to MySQL database.\n");
 		connected = 1;
 		records = 0;
 		connect_time = time(NULL);




More information about the asterisk-addons-commits mailing list