aboutsummaryrefslogtreecommitdiffstats
path: root/cdr/cdr_pgsql.c
diff options
context:
space:
mode:
authoroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-24 11:46:29 +0000
committeroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-24 11:46:29 +0000
commit15e8ae94a9057c796fd8c82a84ec0c32cd4d815b (patch)
treee6a4b22047591a080e5c8b6d533dbdfa70b32a42 /cdr/cdr_pgsql.c
parent87f12a25373294131d6a70c96ce9faf45e634874 (diff)
- Adding whitespace that I found unused outside
- Adding "if (option_debug)" before outputting to DEBUG channel git-svn-id: http://svn.digium.com/svn/asterisk/trunk@8524 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr/cdr_pgsql.c')
-rw-r--r--cdr/cdr_pgsql.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c
index 79919ee5e..4aba559ef 100644
--- a/cdr/cdr_pgsql.c
+++ b/cdr/cdr_pgsql.c
@@ -118,7 +118,8 @@ static int pgsql_log(struct ast_cdr *cdr)
return -1;
}
- ast_log(LOG_DEBUG,"cdr_pgsql: inserting a CDR record.\n");
+ if (option_debug > 1)
+ ast_log(LOG_DEBUG, "cdr_pgsql: inserting a CDR record.\n");
snprintf(sqlcmd,sizeof(sqlcmd),"INSERT INTO %s (calldate,clid,src,dst,dcontext,channel,dstchannel,"
"lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) VALUES"
@@ -126,7 +127,8 @@ static int pgsql_log(struct ast_cdr *cdr)
table,timestr,clid,cdr->src, cdr->dst, dcontext,channel, dstchannel, lastapp, lastdata,
cdr->duration,cdr->billsec,ast_cdr_disp2str(cdr->disposition),cdr->amaflags, cdr->accountcode, uniqueid, userfield);
- ast_log(LOG_DEBUG,"cdr_pgsql: SQL command executed: %s\n",sqlcmd);
+ if (option_debug > 2)
+ ast_log(LOG_DEBUG, "cdr_pgsql: SQL command executed: %s\n",sqlcmd);
/* Test to be sure we're still connected... */
/* If we're connected, and connection is working, good. */
@@ -280,18 +282,21 @@ static int process_my_load_module(struct ast_config *cfg)
return -1;
}
- ast_log(LOG_DEBUG,"cdr_pgsql: got hostname of %s\n",pghostname);
- ast_log(LOG_DEBUG,"cdr_pgsql: got port of %s\n",pgdbport);
- if (pgdbsock)
- ast_log(LOG_DEBUG,"cdr_pgsql: got sock file of %s\n",pgdbsock);
- ast_log(LOG_DEBUG,"cdr_pgsql: got user of %s\n",pgdbuser);
- ast_log(LOG_DEBUG,"cdr_pgsql: got dbname of %s\n",pgdbname);
- ast_log(LOG_DEBUG,"cdr_pgsql: got password of %s\n",pgpassword);
- ast_log(LOG_DEBUG,"cdr_pgsql: got sql table name of %s\n",table);
+ if (option_debug) {
+ ast_log(LOG_DEBUG, "cdr_pgsql: got hostname of %s\n", pghostname);
+ ast_log(LOG_DEBUG, "cdr_pgsql: got port of %s\n", pgdbport);
+ if (pgdbsock)
+ ast_log(LOG_DEBUG, "cdr_pgsql: got sock file of %s\n", pgdbsock);
+ ast_log(LOG_DEBUG, "cdr_pgsql: got user of %s\n", pgdbuser);
+ ast_log(LOG_DEBUG, "cdr_pgsql: got dbname of %s\n", pgdbname);
+ ast_log(LOG_DEBUG, "cdr_pgsql: got password of %s\n", pgpassword);
+ ast_log(LOG_DEBUG, "cdr_pgsql: got sql table name of %s\n", table);
+ }
conn = PQsetdbLogin(pghostname, pgdbport, NULL, NULL, pgdbname, pgdbuser, pgpassword);
if (PQstatus(conn) != CONNECTION_BAD) {
- ast_log(LOG_DEBUG,"Successfully connected to PostgreSQL database.\n");
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Successfully connected to PostgreSQL database.\n");
connected = 1;
} else {
pgerror = PQerrorMessage(conn);