]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
change switch_console_printf to switch_log_printf in mod_cdr. Patch from MODAPP...
authorMichael Jerris <mike@jerris.com>
Thu, 12 Apr 2007 18:14:30 +0000 (18:14 +0000)
committerMichael Jerris <mike@jerris.com>
Thu, 12 Apr 2007 18:14:30 +0000 (18:14 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4920 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/event_handlers/mod_cdr/basecdr.cpp
src/mod/event_handlers/mod_cdr/cdrcontainer.cpp
src/mod/event_handlers/mod_cdr/csvcdr.cpp
src/mod/event_handlers/mod_cdr/curlcdr.cpp
src/mod/event_handlers/mod_cdr/mod_cdr.cpp
src/mod/event_handlers/mod_cdr/mysqlcdr.cpp
src/mod/event_handlers/mod_cdr/odbccdr.cpp
src/mod/event_handlers/mod_cdr/pddcdr.cpp
src/mod/event_handlers/mod_cdr/sqlitecdr.cpp
src/mod/event_handlers/mod_cdr/xmlcdr.cpp

index 63ab6ca6d590b2858f78edf9299ea6f19096bb58..d3cda37d42a7e3a009087af9f3a060ed4d96ec74 100644 (file)
@@ -24,6 +24,7 @@
  * Contributor(s):
  * 
  * Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  *
  * Description: This C++ source file describes the BaseCDR class that all other CDR classes inherit from.
  * It handles the bulk of the processing of data from the switch_channel_t objects.
@@ -214,7 +215,7 @@ void BaseCDR::parse_channel_variables_xconfig(std::string& unparsed,std::list<st
                {
                        if(fixed)
                        {
-                               switch_console_printf(SWITCH_CHANNEL_LOG,"Wildcards are not allow in the fixed chanvars list.  Item removed.\n");
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Wildcards are not allow in the fixed chanvars list.  Item removed.\n");
                                iItr = chanvarlist.erase(iItr);
                        }
                        else
@@ -271,19 +272,19 @@ void BaseCDR::parse_channel_variables_xconfig(std::string& unparsed,std::list<st
                                                sql_type = CDR_TINY;
                                                break;
                                        default:
-                                               switch_console_printf(SWITCH_CHANNEL_LOG,"Valid fixed channel variable types are x (decimal), d (double), i (integer), t (tiny), s (string).  You tried to give a type of %s to chanvar %s.\nReverting this chanvar type to a string type.\n",tempstring2.c_str(),tempstring.c_str());
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Valid fixed channel variable types are x (decimal), d (double), i (integer), t (tiny), s (string).  You tried to give a type of %s to chanvar %s.\nReverting this chanvar type to a string type.\n", tempstring2.c_str(), tempstring.c_str());
                                                sql_type = CDR_STRING;
                                }
                        }
                        else
                        {
-                               switch_console_printf(SWITCH_CHANNEL_LOG,"Valid fixed channel variable types are x (decimal), d (double), i (integer), t (tiny), s (string).  You tried to give a type of %s to chanvar %s.\nReverting this chanvar type to a string type.\n",tempstring2.c_str(),tempstring.c_str());
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Valid fixed channel variable types are x (decimal), d (double), i (integer), t (tiny), s (string).  You tried to give a type of %s to chanvar %s.\nReverting this chanvar type to a string type.\n", tempstring2.c_str(), tempstring.c_str());
                                sql_type = CDR_STRING;
                        }
                }
                else
                {
-                       switch_console_printf(SWITCH_CHANNEL_LOG,"No parameter set, for channel variable %s, using default type of string.\n",iItr->c_str());
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No parameter set, for channel variable %s, using default type of string.\n", iItr->c_str());
                        sql_type = CDR_STRING;
                        tempstring = *iItr;
                }
index d25200661cc1e7f03e26b8bfab9c82a27ece42cf..47286728a53a5ae2a9b1922b3efc6cfd43075596 100644 (file)
@@ -24,6 +24,7 @@
  * Contributor(s):
  * 
  * Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  *
  * Description: This C++ source file describes the CDRContainer singleton object used by mod_cdr to control
  * the creation, processing, and destruction of various CDR logger objects.
@@ -53,7 +54,7 @@ CDRContainer::CDRContainer(switch_memory_pool_t *module_pool)
        newchannel = 0;
        
        if (!(xml = switch_xml_open_cfg(configfile, &cfg, NULL))) 
-               switch_console_printf(SWITCH_CHANNEL_LOG,"open of %s failed\n", configfile);
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", configfile);
        else
        {       
                BaseRegistry& registry(BaseRegistry::get());
@@ -89,7 +90,7 @@ CDRContainer::~CDRContainer()
                ptr->disconnect();
        }
                
-       switch_console_printf(SWITCH_CHANNEL_LOG,"mod_cdr shutdown gracefully.");
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mod_cdr shutdown gracefully.");
 }
 
 #ifdef SWITCH_QUEUE_ENHANCED
@@ -225,7 +226,7 @@ void CDRContainer::add_cdr(switch_core_session_t *session)
                        basecdr_creator func = *it;
                        
                        BaseCDR* newloggerobject = func(newchannel);
-                       switch_console_printf(SWITCH_CHANNEL_LOG,"Adding a new logger object to the queue.\n");
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Adding a new logger object to the queue.\n");
                        switch_queue_push(cdrqueue,newloggerobject);
                }
                newchannel->callerprofile = newchannel->callerprofile->next;
index c3b4756bfc2c4609b74daf3d292e77136757fd22..2d3b775a503de818eb5b4235d64bf5b3fa2baa23 100644 (file)
@@ -24,6 +24,7 @@
  * Contributor(s):
  * 
  * Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  *
  * Description: This C++ source file describes the CsvCDR class that handles processing CDRs to a CSV format.
  * This is the standard CSV module, and has a list of predefined variables to log out which can be
@@ -101,7 +102,7 @@ std::string CsvCDR::display_name = "CsvCDR - The simple comma separated values C
 
 void CsvCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param)
 {
-       switch_console_printf(SWITCH_CHANNEL_LOG, "CsvCDR::connect() - Loading configuration file.\n");
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CsvCDR::connect() - Loading configuration file.\n");
        activated = 0; // Set it as inactive initially
        connectionstate = 0; // Initialize it to false to show that we aren't yet connected.
        
@@ -170,7 +171,7 @@ void CsvCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
                                        convert_time = switch_time_exp_lt;
                                else
                                {
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone.  Possible values are utc and local.  You entered: %s\nDefaulting to local.\n",val);
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone.  Possible values are utc and local.  You entered: %s\nDefaulting to local.\n", val);
                                        convert_time = switch_time_exp_lt;
                                }
                        }
@@ -182,11 +183,11 @@ void CsvCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
                        if(outputfile.good())
                        {
                                activated = 1;
-                               switch_console_printf(SWITCH_CHANNEL_LOG,"CsvCDR activated, log rotation will occur at or after %d MB\n",(int)(filesize_limit >> 20));
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CsvCDR activated, log rotation will occur at or after %d MB\n", (int)(filesize_limit >> 20));
                        }
                }
                else
-                       switch_console_printf(SWITCH_CHANNEL_LOG,"CsvCDR::connect(): You did not specify the minimum parameters for using this module.  You must specify at least a path to have the records logged to.\n");
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CsvCDR::connect(): You did not specify the minimum parameters for using this module.  You must specify at least a path to have the records logged to.\n");
        }
 }
 
@@ -228,7 +229,7 @@ void CsvCDR::open_file()
        outputfile.open(filename.c_str(),std::ios_base::app|std::ios_base::binary);
        if(outputfile.fail())
        {
-               switch_console_printf(SWITCH_CHANNEL_LOG,"Could not open the CSV file %s .  CsvCDR logger will not be functional until this is resolved and a reload is issued.  Failbit is set to %d.\n",filename.c_str(),outputfile.fail());
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open the CSV file %s .  CsvCDR logger will not be functional until this is resolved and a reload is issued.  Failbit is set to %d.\n", filename.c_str(), outputfile.fail());
                activated = 0;
        }
        else
@@ -332,7 +333,7 @@ void CsvCDR::disconnect()
        chanvars_fixed_list.clear();
        chanvars_supp_list.clear();
        connectionstate = 0;
-       switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down CsvCDR...  Done!\n");   
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down CsvCDR...  Done!\n");    
 }
 
 AUTO_REGISTER_BASECDR(CsvCDR);
index bfc55736f90bd77d7715fde3b9c072d9b6d5f180..b2449f3ec373bfeaf68eee41cc9f91e283a0da8c 100644 (file)
@@ -28,6 +28,7 @@
  * Yossi Neiman <freeswitch AT cartissolutions.com>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * Anthony Minessale II <anthmct@yahoo.com>
+ * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  *
  * Description: This C++ source file describes the CurlCDR class that handles processing CDRs to HTTP endpoint.
  * This is the standard Curl module, and has a list of predefined variables to log out which can be
@@ -106,14 +107,14 @@ std::string CurlCDR::postdata;
 
 void CurlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param)
 {
-       switch_console_printf(SWITCH_CHANNEL_LOG, "CurlCDR::connect() - Loading configuration file.\n");
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CurlCDR::connect() - Loading configuration file.\n");
        activated = 0; // Set it as inactive initially
        connectionstate = 0; // Initialize it to false to show that we aren't yet connected.
 
-    switch_console_printf(SWITCH_CHANNEL_LOG,"Checking to see if curlcdr is valid\n");
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking to see if curlcdr is valid\n");
        if ((settings = switch_xml_child(cfg, "curlcdr"))) 
        {
-        switch_console_printf(SWITCH_CHANNEL_LOG,"curlcdr appears to be!!!\n");
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "curlcdr appears to be!!!\n");
                int count_config_params = 0;  // Need to make sure all params are set before we load
                for (param = switch_xml_child(settings, "param"); param; param = param->next) 
                {
@@ -168,7 +169,7 @@ void CurlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settin
                                        convert_time = switch_time_exp_lt;
                                else
                                {
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone.  Possible values are utc and local.  You entered: %s\nDefaulting to local.\n",val);
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone.  Possible values are utc and local.  You entered: %s\nDefaulting to local.\n", val);
                                        convert_time = switch_time_exp_lt;
                                }
                        }
@@ -179,13 +180,13 @@ void CurlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settin
             if(strlen(gateway_url))
                        {
                                activated = 1;
-                               switch_console_printf(SWITCH_CHANNEL_LOG,"CurlCDR activated");
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CurlCDR activated");
                        }
             else
-                switch_console_printf(SWITCH_CHANNEL_LOG,"CurlCDR::connect(): You must specify a gateway_url to have the records logged to.\n");
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CurlCDR::connect(): You must specify a gateway_url to have the records logged to.\n");
                }
                else
-                       switch_console_printf(SWITCH_CHANNEL_LOG,"CurlCDR::connect(): You did not specify the minimum parameters for using this module.  You must specify at least a gateway_url to have the records logged to.\n");
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CurlCDR::connect(): You did not specify the minimum parameters for using this module.  You must specify at least a gateway_url to have the records logged to.\n");
        }
 }
 
@@ -370,7 +371,7 @@ void CurlCDR::disconnect()
        chanvars_fixed_list.clear();
        chanvars_supp_list.clear();
        connectionstate = 0;
-       switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down CurlCDR...  Done!");    
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down CurlCDR...  Done!");     
 }
 
 AUTO_REGISTER_BASECDR(CurlCDR);
index d8d46afadfb67adb57ebd87184f0677a80c41f19..4507d68b1b59cf5260b1dd20403713cde7072d25 100644 (file)
@@ -24,6 +24,7 @@
  * Contributor(s):
  * 
  * Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  *
  * Description: This source file describes the most basic portions of the CDR module.  These are the functions
  * and structures that the Freeswitch core looks for when opening up the DSO file to create the load, shutdown
@@ -130,7 +131,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
        
        if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) 
        {
-               switch_console_printf(SWITCH_CHANNEL_LOG, "OH OH - Can't swim, no pool\n");
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH - Can't swim, no pool\n");
                return SWITCH_STATUS_TERM;
        }
 
@@ -144,7 +145,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
 {
        RUNNING = 1;
-       switch_console_printf(SWITCH_CHANNEL_LOG, "mod_cdr made it to runtime.  Wee!\n");
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mod_cdr made it to runtime.  Wee!\n");
        newcdrcontainer->process_records();
        
        return RUNNING ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_TERM;
index 897375e132e85d0355cc54bfb64ee47626dc06a8..051c9304162ff762390e74ccdd7cc82bd9e20166 100644 (file)
@@ -24,6 +24,7 @@
  * Contributor(s):
  * 
  * Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  *
  * Description: This C++ source file describes the MysqlCDR class which handles formatting a CDR out to
  * a MySQL 4.1.x or greater server using prepared statements.
@@ -183,7 +184,7 @@ void MysqlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setti
                                        convert_time = switch_time_exp_lt;
                                else
                                {
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone.  Possible values are utc and local.  You entered: %s\nDefaulting to local.\n",val);
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone.  Possible values are utc and local.  You entered: %s\nDefaulting to local.\n", val);
                                        convert_time = switch_time_exp_lt;
                                }
                        }
@@ -192,7 +193,7 @@ void MysqlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setti
                if (count_config_params==4)
                        activated = 1;
                else
-                       switch_console_printf(SWITCH_CHANNEL_LOG,"You did not specify the minimum parameters for using this module.  You must specify a hostname, username, password, and database to use MysqlCDR.  You only supplied %d parameters.\n",count_config_params);
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You did not specify the minimum parameters for using this module.  You must specify a hostname, username, password, and database to use MysqlCDR.  You only supplied %d parameters.\n", count_config_params);
                
                if(activated)
                {
@@ -241,7 +242,7 @@ void MysqlCDR::connect_to_database()
        if(mysql_real_connect(conn,hostname,username,password,dbname,0,NULL,0) == NULL)
        {
                const char *error1 = mysql_error(conn);
-               switch_console_printf(SWITCH_CHANNEL_LOG,"Cannot connect to MySQL Server.  The error was: %s\n",error1);
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot connect to MySQL Server.  The error was: %s\n", error1);
        }
        else
                connectionstate = 1;
@@ -446,7 +447,7 @@ bool MysqlCDR::process_record()
                                        break;
                                }
                                default:
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"We should not get to this point in this switch/case statement.\n");
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We should not get to this point in this switch/case statement.\n");
                        }
                        i++;
                }
@@ -466,13 +467,13 @@ bool MysqlCDR::process_record()
                                case CR_SERVER_GONE_ERROR:
                                case CR_SERVER_LOST:
                                {
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"We lost connection to the MySQL server.  Trying to reconnect.\n");
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "We lost connection to the MySQL server.  Trying to reconnect.\n");
                                        connect_to_database();
                                        break;
                                }
                                default:
                                {
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"We have encountered an unknown error when pinging the MySQL server.  Attempting to reconnect anyways.\n");
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "We have encountered an unknown error when pinging the MySQL server.  Attempting to reconnect anyways.\n");
                                        connect_to_database();
                                }
                        }
@@ -485,10 +486,10 @@ bool MysqlCDR::process_record()
                        if(mysql_stmt_error_code != 0)
                        {
                                errorstate = 1;
-                               switch_console_printf(SWITCH_CHANNEL_LOG,"MysqlCDR::process_record() - Statement executed? Error: %d\n",mysql_stmt_error_code);
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MysqlCDR::process_record() - Statement executed? Error: %d\n", mysql_stmt_error_code);
                        
                                const char* mysql_stmt_error_string = mysql_stmt_error(stmt);
-                               switch_console_printf(SWITCH_CHANNEL_LOG,"MySQL encountered error: %s\n",mysql_stmt_error_string);
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MySQL encountered error: %s\n", mysql_stmt_error_string);
                        }
                        else
                                errorstate = 0;
@@ -585,7 +586,7 @@ bool MysqlCDR::process_record()
                                        break;
                                }
                                default:
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"We should not get to this point in this switch/case statement.\n");
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We should not get to this point in this switch/case statement.\n");
                        }
                        
                        bool* tempbool = (bool*) temp_chanvars_holder.front();
index 331f803be847b72e617fd1d3d3853ffa5d0f718c..c11eca936bd497017fdbdd4b7ce6828bc1c11a2f 100644 (file)
@@ -24,6 +24,7 @@
  * Contributor(s):
  * 
  * Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  *
  * Description: This C++ source file describes the OdbcCDR class which handles formatting a CDR out to
  * an ODBC backend using prepared statements.
@@ -201,7 +202,7 @@ void OdbcCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settin
                                        convert_time = switch_time_exp_lt;
                                else
                                {
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone.  Possible values are utc and local.  You entered: %s\nDefaulting to local.\n",val);
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone.  Possible values are utc and local.  You entered: %s\nDefaulting to local.\n", val);
                                        convert_time = switch_time_exp_lt;
                                }
                        }
@@ -216,7 +217,7 @@ void OdbcCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settin
                if (count_config_params==4)
                        activated = 1;
                else
-                       switch_console_printf(SWITCH_CHANNEL_LOG,"You did not specify the minimum parameters for using this module.  You must specify a DSN,hostname, username, password, and database to use OdbcCDR.  You only supplied %d parameters.\n",count_config_params);
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You did not specify the minimum parameters for using this module.  You must specify a DSN,hostname, username, password, and database to use OdbcCDR.  You only supplied %d parameters.\n", count_config_params);
                
                if(activated)
                {
@@ -275,7 +276,7 @@ void OdbcCDR::connect_to_database()
                ODBC_res = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &ODBC_env);
                if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) 
                {
-                       switch_console_printf(SWITCH_CHANNEL_LOG,"Error allocating a new ODBC handle.\n");
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error allocating a new ODBC handle.\n");
                        connectionstate = 0;
                }
        }
@@ -284,7 +285,7 @@ void OdbcCDR::connect_to_database()
        
        if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) 
        {
-               switch_console_printf(SWITCH_CHANNEL_LOG,"Error with ODBCSetEnv\n");
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error with ODBCSetEnv\n");
                SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env);
                connectionstate = 0;
        }
@@ -293,7 +294,7 @@ void OdbcCDR::connect_to_database()
 
        if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
        {
-               switch_console_printf(SWITCH_CHANNEL_LOG,"Error AllocHDB %d\n",ODBC_res);
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error AllocHDB %d\n", ODBC_res);
                SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env);
                connectionstate = 0;
        }
@@ -306,14 +307,14 @@ void OdbcCDR::connect_to_database()
        ODBC_res = SQLConnect(ODBC_con, (SQLCHAR*)dsn, SQL_NTS, (SQLCHAR*)username, SQL_NTS, (SQLCHAR*)password, SQL_NTS);
        if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) 
        {
-               switch_console_printf(SWITCH_CHANNEL_LOG,"Error connecting to the ODBC database on %d\n",ODBC_res);
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error connecting to the ODBC database on %d\n", ODBC_res);
                SQLFreeHandle(SQL_HANDLE_DBC, ODBC_con);
                SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env);
                connectionstate = 0;
        }
        else 
        {
-               switch_console_printf(SWITCH_CHANNEL_LOG,"Connected to %s\n", dsn);
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connected to %s\n", dsn);
                connectionstate = 1;
        }
        
@@ -325,7 +326,7 @@ void OdbcCDR::connect_to_database()
 
        if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
        {
-               switch_console_printf(SWITCH_CHANNEL_LOG,"Failure in allocating a prepared statement %d\n", ODBC_res);
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure in allocating a prepared statement %d\n", ODBC_res);
                SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
        }
                
@@ -333,7 +334,7 @@ void OdbcCDR::connect_to_database()
 
        if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
        {
-               switch_console_printf(SWITCH_CHANNEL_LOG,"Error in preparing a statement: %d\n", ODBC_res);
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error in preparing a statement: %d\n", ODBC_res);
                SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
        }
                
@@ -343,7 +344,7 @@ void OdbcCDR::connect_to_database()
 
                if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
                {
-                       switch_console_printf(SWITCH_CHANNEL_LOG,"Failure in allocating a prepared statement %d\n", ODBC_res);
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure in allocating a prepared statement %d\n", ODBC_res);
                        SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt_chanvars);
                }
                
@@ -351,7 +352,7 @@ void OdbcCDR::connect_to_database()
 
                if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
                {
-                       switch_console_printf(SWITCH_CHANNEL_LOG,"Error in preparing a statement: %d\n", ODBC_res);
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error in preparing a statement: %d\n", ODBC_res);
                        SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
                }
        }
@@ -360,7 +361,7 @@ void OdbcCDR::connect_to_database()
        
        if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
        {
-               switch_console_printf(SWITCH_CHANNEL_LOG,"Failure in allocating a prepared statement %d\n", ODBC_res);
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure in allocating a prepared statement %d\n", ODBC_res);
                SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt_ping);
        }
        
@@ -368,7 +369,7 @@ void OdbcCDR::connect_to_database()
        
        if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
        {
-               switch_console_printf(SWITCH_CHANNEL_LOG,"Error in preparing a statement: %d\n", ODBC_res);
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error in preparing a statement: %d\n", ODBC_res);
                SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt_ping);
        }
        
@@ -400,7 +401,7 @@ bool OdbcCDR::process_record()
                if(ODBC_res != SQL_SUCCESS && ODBC_res != SQL_SUCCESS_WITH_INFO)
                {
                        // Try to reconnect and reprepare
-                       switch_console_printf(SWITCH_CHANNEL_LOG,"Error pinging the ODBC backend.  Attempt #%d to reconnect.\n",count+1);
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error pinging the ODBC backend.  Attempt #%d to reconnect.\n", count+1);
                        connect_to_database();
                }
        }
@@ -502,7 +503,7 @@ bool OdbcCDR::process_record()
                                        break;
                                }
                                default:
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"We should not get to this point in this switch/case statement.\n");
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We should not get to this point in this switch/case statement.\n");
                        }
                        i++;
                }
@@ -585,7 +586,7 @@ bool OdbcCDR::process_record()
                                        break;
                                }
                                default:
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"We should not get to this point in this switch/case statement.\n");
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We should not get to this point in this switch/case statement.\n");
                        }
                }
        }
index e1f65abd1adfd5d104c1e78ee40ac8fa178ddd67..657cf7d4118262c5ac7aa85fa7396d8986fd838b 100644 (file)
@@ -24,6 +24,7 @@
  * Contributor(s):
  * 
  * Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  *
  * Description: This C++ source file describes the PddCDR class which handles formatting a CDR out to
  * individual text files in a Perl Data Dumper format.
@@ -101,7 +102,7 @@ std::string PddCDR::display_name = "PddCDR - Perl Data Dumper CDR logger";
 
 void PddCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param)
 {
-       switch_console_printf(SWITCH_CHANNEL_LOG, "PddCDR::connect() - Loading configuration file.\n");
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PddCDR::connect() - Loading configuration file.\n");
        activated = 0; // Set it as inactive initially
        connectionstate = 0; // Initialize it to false to show that we aren't yet connected.
        
@@ -135,11 +136,11 @@ void PddCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
                        }
                        else if (!strcmp(var, "chanvars_fixed"))
                        {
-                               switch_console_printf(SWITCH_CHANNEL_LOG,"PddCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format.  Please use the setting parameter of \"chanvars\" instead and try again.\n");
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "PddCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format.  Please use the setting parameter of \"chanvars\" instead and try again.\n");
                        }
                        else if (!strcmp(var, "chanvars_supp"))
                        {
-                               switch_console_printf(SWITCH_CHANNEL_LOG,"PddCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format.  Please use the setting parameter of \"chanvars\" instead and try again.\n");
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "PddCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format.  Please use the setting parameter of \"chanvars\" instead and try again.\n");
                        }
                        else if(!strcmp(var,"timezone"))
                        {
@@ -149,7 +150,7 @@ void PddCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
                                        convert_time = switch_time_exp_lt;
                                else
                                {
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone.  Possible values are utc and local.  You entered: %s\nDefaulting to local.\n",val);
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone.  Possible values are utc and local.  You entered: %s\nDefaulting to local.\n", val);
                                        convert_time = switch_time_exp_lt;
                                }
                        }
@@ -158,7 +159,7 @@ void PddCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
                if(count_config_params > 0)
                        activated = 1;
                else
-                       switch_console_printf(SWITCH_CHANNEL_LOG,"PddCDR::connect(): You did not specify the minimum parameters for using this module.  You must specify at least a path to have the records logged to.\n");
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PddCDR::connect(): You did not specify the minimum parameters for using this module.  You must specify at least a path to have the records logged to.\n");
        }
 }
 
@@ -168,7 +169,7 @@ bool PddCDR::process_record()
        
        bool retval = 0;
        if(!outputfile)
-               switch_console_printf(SWITCH_CHANNEL_LOG, "PddCDR::process_record():  Unable to open file  %s to commit the call record to.  Invalid path name, invalid permissions, or no space available?\n",outputfile_name.c_str());
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PddCDR::process_record():  Unable to open file  %s to commit the call record to.  Invalid path name, invalid permissions, or no space available?\n",outputfile_name.c_str());
        else
        {
                // Format the call record and proceed from here...
@@ -247,7 +248,7 @@ void PddCDR::disconnect()
        logchanvars = 0;
        outputfile_path.clear();
        chanvars_supp_list.clear();
-       switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down PddCDR...  Done!");     
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down PddCDR...  Done!");      
 }
 
 AUTO_REGISTER_BASECDR(PddCDR);
index 71630ac9d39d195c5b1e76865d52b60f9fc2d7fd..a57d7c6f38295f367c4ff6206684cd7dae837978 100644 (file)
@@ -24,6 +24,7 @@
  * Contributor(s):
  * 
  * Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  *
  * Description: his C++ header file describes the SqliteCDR class which handles formatting a CDR out to
  * a SQLite database using prepared statements.
@@ -141,7 +142,7 @@ void SqliteCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& sett
                                        use_utc_time = 0;
                                else
                                {
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone.  Possible values are utc and local.  You entered: %s\nDefaulting to local.\n",val);
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone.  Possible values are utc and local.  You entered: %s\nDefaulting to local.\n", val);
                                        use_utc_time = 0;
                                }
                        }
@@ -150,7 +151,7 @@ void SqliteCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& sett
                if (count_config_params==1)
                        activated = 1;
                else
-                       switch_console_printf(SWITCH_CHANNEL_LOG,"You did not specify the minimum parameters for using this module.  You must specify an explicit (complete) path to the location of the database file in order to use SqliteCDR.\n");
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You did not specify the minimum parameters for using this module.  You must specify an explicit (complete) path to the location of the database file in order to use SqliteCDR.\n");
                
                if(activated)
                {
@@ -192,7 +193,7 @@ void SqliteCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& sett
                        
                        if(sql_rc != SWITCH_CORE_DB_OK)
                        {
-                               switch_console_printf(SWITCH_CHANNEL_LOG,"There was an error opening database filename %s.  The error was: %s.  SqliteCDR logging has been disabled until the problem is resolved and modcdr_reload is initiated.\n",db_filename.c_str(),switch_core_db_errmsg(db));
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "There was an error opening database filename %s.  The error was: %s.  SqliteCDR logging has been disabled until the problem is resolved and modcdr_reload is initiated.\n", db_filename.c_str(), switch_core_db_errmsg(db));
                                activated = 0;
                                switch_core_db_close(db);
                        }
@@ -223,13 +224,13 @@ void SqliteCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& sett
                                        }
                                }
                                else
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"There was an error in executing query %s: The error was %s.\n",sql_query_check_tables,errormessage);
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "There was an error in executing query %s: The error was %s.\n", sql_query_check_tables, errormessage);
                                
                                switch_core_db_free_table(result);
                        
                                if(!temp_sql_tables["freeswitchcdr"])
                                {
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"Creating the freeswitchcdr table in the SQLite mod_cdr database file.\n");
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating the freeswitchcdr table in the SQLite mod_cdr database file.\n");
                                        // Must create the missing freeswitchcdr table.
                                        char sql_query_create_freeswitchcdr[] = "CREATE TABLE freeswitchcdr (\n"
                                                "callid INTEGER PRIMARY KEY AUTOINCREMENT,\n"
@@ -262,7 +263,7 @@ void SqliteCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& sett
                        
                                if(!temp_sql_tables["chanvars"])
                                {
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"Creating the chanvars table in the SQLite mod_cdr database file.\n");
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating the chanvars table in the SQLite mod_cdr database file.\n");
                                        // Must create the missing chanvars table.
                                        char sql_query_create_chanvars[] = "CREATE TABLE chanvars (\n"
                                                "callid INTEGER default 0,\n"
@@ -321,13 +322,13 @@ void SqliteCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& sett
                                                                                tempstring2 = resultstring.substr(i,(j-i));
                                                                
                                                                        freeswitchcdr_columns[tempstring1] = tempstring2;
-                                                                       // switch_console_printf(SWITCH_CHANNEL_LOG,"tempstring1 = %s, tempstring2 = %s\n",tempstring1.c_str(),tempstring2.c_str());
+                                                                       //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tempstring1 = %s, tempstring2 = %s\n", tempstring1.c_str(), tempstring2.c_str());
                                                                        if(resultstring.find('\n',j+1) == (j+1))
                                                                                j++;
                                                                        i = j+1;
                                                                }
                                                                else
-                                                                       switch_console_printf(SWITCH_CHANNEL_LOG,"There has been a parsing problem with the freeswitchcdr schema.\n");
+                                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "There has been a parsing problem with the freeswitchcdr schema.\n");
                                                        }
                                                }
                                        }
@@ -346,9 +347,9 @@ void SqliteCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& sett
                                                        case CDR_TINY:
                                                                if(freeswitchcdr_columns.find(*iItr) != freeswitchcdr_columns.end())
                                                                {
-                                                                       //switch_console_printf(SWITCH_CHANNEL_LOG,"freeswitchcdr_columns[%s] == %s.\n",iItr->c_str(),freeswitchcdr_columns[*iItr].c_str());
+                                                                       //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "freeswitchcdr_columns[%s] == %s.\n", iItr->c_str(), freeswitchcdr_columns[*iItr].c_str());
                                                                        if(freeswitchcdr_columns[*iItr].find("INTEGER",0) == std::string::npos)
-                                                                               switch_console_printf(SWITCH_CHANNEL_LOG,"WARNING: SqliteCDR freeswitchcdr table column type mismatch: Column \"%s\" is not of an INTEGER type.  This is not necessarily fatal, but may result in unexpected behavior.\n",iItr->c_str());
+                                                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SqliteCDR freeswitchcdr table column type mismatch: Column \"%s\" is not of an INTEGER type.  This is not necessarily fatal, but may result in unexpected behavior.\n", iItr->c_str());
                                                                }
                                                                else
                                                                        freeswitchcdr_add_columns[*iItr] = "INTEGER";
@@ -357,7 +358,7 @@ void SqliteCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& sett
                                                                if(freeswitchcdr_columns.find(*iItr) != freeswitchcdr_columns.end())
                                                                {
                                                                        if(freeswitchcdr_columns[*iItr].find("REAL",0) == std::string::npos)
-                                                                               switch_console_printf(SWITCH_CHANNEL_LOG,"WARNING: SqliteCDR freeswitchcdr table column type mismatch: Column \"%s\" is not of a REAL type.  This is not necessarily fatal, but may result in unexpected behavior.\n",iItr->c_str());
+                                                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SqliteCDR freeswitchcdr table column type mismatch: Column \"%s\" is not of a REAL type.  This is not necessarily fatal, but may result in unexpected behavior.\n", iItr->c_str());
                                                                }
                                                                else
                                                                        freeswitchcdr_add_columns[*iItr] = "REAL";
@@ -367,19 +368,19 @@ void SqliteCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& sett
                                                                if(freeswitchcdr_columns.find(*iItr) != freeswitchcdr_columns.end())
                                                                {
                                                                        if(freeswitchcdr_columns[*iItr].find("TEXT",0) == std::string::npos)
-                                                                               switch_console_printf(SWITCH_CHANNEL_LOG,"WARNING: SqliteCDR freeswitchcdr table column type mismatch: Column \"%s\" is not of a TEXT type.  This is not necessarily fatal, but may result in unexpected behavior.\n",iItr->c_str());
+                                                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SqliteCDR freeswitchcdr table column type mismatch: Column \"%s\" is not of a TEXT type.  This is not necessarily fatal, but may result in unexpected behavior.\n", iItr->c_str());
                                                                }
                                                                else
                                                                        freeswitchcdr_add_columns[*iItr] = "TEXT";
                                                                break;
                                                        default:
-                                                               switch_console_printf(SWITCH_CHANNEL_LOG,"Oh bother, I should not have fallen into this hole in the switch/case statement.  Please notify the author.\n");
+                                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oh bother, I should not have fallen into this hole in the switch/case statement.  Please notify the author.\n");
                                                }
                                        }
                                        
                                        if(freeswitchcdr_add_columns.size())
                                        {
-                                               switch_console_printf(SWITCH_CHANNEL_LOG,"Updating the freeswitchcdr table schema.\n");
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Updating the freeswitchcdr table schema.\n");
                                                std::string tempsql_freeswitchcdr_alter_table = "ALTER TABLE freeswitchcdr ADD ";
                                                std::map<std::string, std::string>::iterator iItr, iEnd;
                                                for(iItr = freeswitchcdr_add_columns.begin(), iEnd = freeswitchcdr_add_columns.end(); iItr != iEnd; iItr++)
@@ -388,7 +389,7 @@ void SqliteCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& sett
                                                        sql_query_freeswitchcdr_alter_table.append(iItr->first);
                                                        sql_query_freeswitchcdr_alter_table.append(" ");
                                                        sql_query_freeswitchcdr_alter_table.append(iItr->second);
-                                                       switch_console_printf(SWITCH_CHANNEL_LOG,"Updating the freeswitchcdr table with the following SQL command: %s.\n",sql_query_freeswitchcdr_alter_table.c_str());
+                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Updating the freeswitchcdr table with the following SQL command: %s.\n", sql_query_freeswitchcdr_alter_table.c_str());
                                                        switch_core_db_exec(db, sql_query_freeswitchcdr_alter_table.c_str(), NULL, NULL, NULL);
                                                }
                                        }
@@ -514,7 +515,7 @@ bool SqliteCDR::process_record()
                                        break;
                                }
                                default:
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"Oh bother, I should not have fallen into this hole in the switch/case statement.  Please notify the author.\n");
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oh bother, I should not have fallen into this hole in the switch/case statement.  Please notify the author.\n");
                        }
                }
        }
@@ -525,7 +526,7 @@ bool SqliteCDR::process_record()
                if(sql_rc == SWITCH_CORE_DB_BUSY)
                        sql_rc = switch_core_db_step(stmt);
                else if (sql_rc == SWITCH_CORE_DB_ERROR || sql_rc == SWITCH_CORE_DB_MISUSE)
-                       switch_console_printf(SWITCH_CHANNEL_LOG,"There was an error executing switch_core_db_step on SqliteCDR::stmt.  The error was: %s\n",switch_core_db_errmsg(db));
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "There was an error executing switch_core_db_step on SqliteCDR::stmt.  The error was: %s\n", switch_core_db_errmsg(db));
        }
        
        sql_rc = switch_core_db_reset(stmt);
@@ -546,7 +547,7 @@ bool SqliteCDR::process_record()
                                if(sql_rc == SWITCH_CORE_DB_BUSY)
                                        sql_rc = switch_core_db_step(stmt_chanvars);
                                else if (sql_rc == SWITCH_CORE_DB_ERROR || sql_rc == SWITCH_CORE_DB_MISUSE)
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"There was an error executing switch_core_db_step on SqliteCDR::stmt_chanvars.  The error was: %s\n",switch_core_db_errmsg(db));
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "There was an error executing switch_core_db_step on SqliteCDR::stmt_chanvars.  The error was: %s\n", switch_core_db_errmsg(db));
                        }
                        
                        switch_core_db_reset(stmt_chanvars);
index 2033a8955c130e8d5d7940a80a8e686ed457b8f5..01e98785793ba8a188f8863ed2a1be679e3a33db 100644 (file)
@@ -25,6 +25,7 @@
  * 
  * Yossi Neiman <freeswitch AT cartissolutions.com>
  * Ken Rice of Asteria Solutions Group, INC <ken AT asteriasgi.com>
+ * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  * 
  * Description: This C++ source file describes the XmlCDR class which handles formatting a CDR out to
  * individual text files in a XML format.
@@ -103,7 +104,7 @@ std::string XmlCDR::display_name = "XmlCDR - The rough implementation of XML CDR
 
 void XmlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param)
 {
-       switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::connect() - Loading configuration file.\n");
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "XmlCDR::connect() - Loading configuration file.\n");
        activated = 0; // Set it as inactive initially
        connectionstate = 0; // Initialize it to false to show that we aren't yet connected.
        
@@ -137,11 +138,11 @@ void XmlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
                        }
                        else if (!strcmp(var, "chanvars_fixed"))
                        {
-                               switch_console_printf(SWITCH_CHANNEL_LOG,"XmlCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format.  Please use the setting parameter of \"chanvars\" instead and try again.\n");
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "XmlCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format.  Please use the setting parameter of \"chanvars\" instead and try again.\n");
                        }
                        else if (!strcmp(var, "chanvars_supp"))
                        {
-                               switch_console_printf(SWITCH_CHANNEL_LOG,"XmlCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format.  Please use the setting parameter of \"chanvars\" instead and try again.\n");
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "XmlCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format.  Please use the setting parameter of \"chanvars\" instead and try again.\n");
                        }
                        else if(!strcmp(var,"timezone"))
                        {
@@ -151,7 +152,7 @@ void XmlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
                                        convert_time = switch_time_exp_lt;
                                else
                                {
-                                       switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone.  Possible values are utc and local.  You entered: %s\nDefaulting to local.\n",val);
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone.  Possible values are utc and local.  You entered: %s\nDefaulting to local.\n", val);
                                        convert_time = switch_time_exp_lt;
                                }
                        }
@@ -160,7 +161,7 @@ void XmlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& setting
                if(count_config_params > 0)
                        activated = 1;
                else
-                       switch_console_printf(SWITCH_CHANNEL_LOG,"XmlCDR::connect(): You did not specify the minimum parameters for using this module.  You must specify at least a path to have the records logged to.\n");
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "XmlCDR::connect(): You did not specify the minimum parameters for using this module.  You must specify at least a path to have the records logged to.\n");
        }
 }
 
@@ -170,10 +171,10 @@ bool XmlCDR::process_record()
        outputfile.open(outputfile_name.c_str());
        
        if(!outputfile)
-               switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::process_record():  Unable to open file  %s to commit the call record to.  Invalid path name, invalid permissions, or no space available?\n",outputfile_name.c_str());
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "XmlCDR::process_record():  Unable to open file  %s to commit the call record to.  Invalid path name, invalid permissions, or no space available?\n", outputfile_name.c_str());
        else
        {
-               //switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::process_record():  Preping the CDR to %s.\n",outputfile_name.c_str());
+               //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "XmlCDR::process_record():  Preping the CDR to %s.\n", outputfile_name.c_str());
                // Format the call record and proceed from here...
                outputfile << "<?xml version=\"1.0\"?>" << std::endl;
                outputfile << "<document type=\"freeswitch-cdr/xml\">" << std::endl;
@@ -215,7 +216,7 @@ bool XmlCDR::process_record()
                }
                outputfile << "\t</chanvars>" << std::endl << "</document>" << std::endl << std::endl;
 
-               //switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::process_record():  Dumping the CDR to %s.\n",outputfile_name.c_str());
+               //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "XmlCDR::process_record():  Dumping the CDR to %s.\n", outputfile_name.c_str());
                retval = 1;
        }
        
@@ -249,7 +250,7 @@ void XmlCDR::disconnect()
        logchanvars = 0;
        outputfile_path.clear();
        chanvars_supp_list.clear();
-       switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down XmlCDR...  Done!");     
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down XmlCDR...  Done!");      
 }
 
 AUTO_REGISTER_BASECDR(XmlCDR);