[Astpp-commit] SF.net SVN: astpp: [2153] trunk
Brought to you by:
darrenkw
From: <dar...@us...> - 2007-11-03 23:06:09
|
Revision: 2153 http://astpp.svn.sourceforge.net/astpp/?rev=2153&view=rev Author: darrenkw Date: 2007-11-03 16:06:13 -0700 (Sat, 03 Nov 2007) Log Message: ----------- Start with enhanced logging. Modified Paths: -------------- trunk/astpp-admin.cgi trunk/modules/ASTPP/lib/ASTPP.pm Modified: trunk/astpp-admin.cgi =================================================================== --- trunk/astpp-admin.cgi 2007-11-03 22:29:23 UTC (rev 2152) +++ trunk/astpp-admin.cgi 2007-11-03 23:06:13 UTC (rev 2153) @@ -65,7 +65,7 @@ $freepbx_db $rt_db $openser_db $ASTPP); my $starttime = [gettimeofday]; $ASTPP = ASTPP->new; -$ASTPP->set_verbosity($verbosity); #Tell ASTPP debugging how verbose we want to be. +$ASTPP->set_verbosity(4); #Tell ASTPP debugging how verbose we want to be. $ASTPP->set_asterisk_agi($AGI); $ASTPP->set_pagination_script("astpp-admin.cgi"); my @Home = ( gettext("Home Page") ); @@ -220,14 +220,10 @@ $status .= gettext("Login Failed") . "<br>"; print header(); } - print STDERR gettext("ASTPP-USER:") . " $params->{username}\n" - if $config->{debug} == 1; - print STDERR gettext("ASTPP-PASS:") . " $params->{password}\n" - if $config->{debug} == 1; - print STDERR gettext("ASTPP-AUTHCODE:") . " $config->{auth}\n" - if $config->{debug} == 1; - print STDERR gettext("ASTPP-USER-COUNT:") . " $count" - if $config->{debug} == 1; + $ASTPP->debug( user=> $param->{username}, debug => gettext("ASTPP-USER:") . " $params->{username}"); + $ASTPP->debug( user=> $param->{username}, debug => gettext("ASTPP-PASS:") . " $params->{password}"); + $ASTPP->debug( user=> $param->{username}, debug => gettext("ASTPP-AUTHCODE:") . " $config->{auth}"); + $ASTPP->debug( user=> $param->{username}, debug => gettext("ASTPP-USER-COUNT:") . " $count"); return ( $params->{mode}, $count ); } @@ -272,13 +268,13 @@ $status .= gettext("Login Failed") . "<br>"; $count = 0; } - print STDERR gettext("ASTPP-USER:") . " $params->{username}\n" + $ASTPP->debug( user=> $param->{username}, debug => gettext("ASTPP-USER:") . " $params->{username}") if $config->{debug} == 1 && $params->{username}; - print STDERR gettext("ASTPP-PASS:") . " $params->{password}\n" + $ASTPP->debug( user=> $param->{username}, debug => gettext("ASTPP-PASS:") . " $params->{password}") if $config->{debug} == 1 && $params->{password}; - print STDERR gettext("ASTPP-AUTHCODE:") . " $config->{auth}\n" + $ASTPP->debug( user=> $param->{username}, debug => gettext("ASTPP-AUTHCODE:") . " $config->{auth}") if $config->{debug} == 1; - print STDERR gettext("ASTPP-USER-COUNT:") . " $count" + $ASTPP->debug( user=> $param->{username}, debug => gettext("ASTPP-USER-COUNT:") . " $count") if $config->{debug} == 1; print header(); return $count; @@ -305,9 +301,7 @@ my ($selected) = @_; my ( $tmp, $body, $x ); my $i = 0; - print STDERR "START OF MENU" if $config->{debug} == 1; foreach $tmp (@modes) { - print STDERR $tmp . "\n" if $config->{debug} == 1; $body .= "<div class=\"ts_ddm\" name=tt$i id=tt$i style=\"visibility:hidden;width:200;background-color:#CCCCFF;\"onMouseover=\"clearhidemenu()\" onMouseout=\"dynamichide(event)\"><table width=100\% border=0 cellspacing=0 cellpadding=0>"; my $j = 0; @@ -334,9 +328,6 @@ sub build_body() { if ( $params->{logintype} == 2 ) { #Admin Login - - # return &build_configure() - # if $params->{mode} eq gettext("Configuration"); return &build_providers() if $params->{mode} eq gettext("Providers"); return &build_trunks() if $params->{mode} eq gettext("Trunks"); return &build_outbound_routes() @@ -991,7 +982,7 @@ my ($bth,$dst,$idd,$atmpt,$cmplt,$asr,$acd,$mcd,$act,$bill,$price,$cost); my $query = "CREATE TEMPORARY TABLE $table SELECT * FROM cdrs WHERE uniqueid != '' AND $where"; $sth = $astpp_db->do($query) || return gettext("Something is wrong with astpp database"). "\n"; - print STDERR " SQL: $query \n " if $config->{debug} == 1; + $ASTPP->debug( user => $param->{username}, debug => " SQL: $query ");; my $sql = $astpp_db->prepare("SELECT DISTINCT cardnum AS $name FROM $table"); $sql->execute() || return gettext("Something is wrong with astpp database"). "\n"; @@ -1041,7 +1032,6 @@ $in = substr($in,0,-1) if length($in) > 0; $sql3->finish; - print STDERR " SQL: SELECT SUM(duration) AS actual FROM cdr WHERE uniqueid IN ($in) \n " if $config->{debug} == 1; my $sql4 = $cdr_db->prepare("SELECT SUM(duration) AS actual FROM cdr WHERE uniqueid IN ($in)"); $sql4->execute() || return gettext("Something is wrong with cdr database"). "\n"; my $row4 = $sql4->fetchrow_hashref(); @@ -1156,7 +1146,7 @@ and calldate <= " . $cdr_db->quote($ed) . " and (dstchannel like '$row->{tech}/$row->{path}%' or dstchannel like '$row->{tech}\[$row->{path}\]%' ) "; - print STDERR " SQL: $sql1 \n " if $config->{debug} == 1; + $ASTPP->debug( user => $param->{username}, debug => " SQL: $sql1 \n "); my $sth1 = $cdr_db->prepare($sql1); $sth1->execute(); my $ref1 = $sth1->fetchrow_hashref(); @@ -1172,7 +1162,7 @@ or dstchannel like '$row->{tech}\[$row->{path}\]%' ) "; my $sth2 = $cdr_db->prepare($sql2); - print STDERR " SQL: $sql2 \n " if $config->{debug} == 1; + $ASTPP->debug( user => $param->{username}, debug =>" SQL: $sql2"); $sth2->execute(); my $ref2 = $sth2->fetchrow_hashref(); $sth2->finish; @@ -1185,7 +1175,7 @@ or dstchannel like '$row->{tech}\[$row->{path}\]%' ) "; my $sth3 = $cdr_db->prepare($sql3); - print STDERR " SQL: $sql3 \n " if $config->{debug} == 1; + $ASTPP->debug( user => $param->{username}, debug =>" SQL: $sql3"); $sth3->execute(); my $ref3 = $sth3->fetchrow_hashref(); $sth3->finish; Modified: trunk/modules/ASTPP/lib/ASTPP.pm =================================================================== --- trunk/modules/ASTPP/lib/ASTPP.pm 2007-11-03 22:29:23 UTC (rev 2152) +++ trunk/modules/ASTPP/lib/ASTPP.pm 2007-11-03 23:06:13 UTC (rev 2153) @@ -34,7 +34,7 @@ my ($class,%arg) = @_; bless { _astpp_db => $_[1], - _verbosity => $arg{verbosity_level} || 1, + _verbosity_level => $arg{verbosity_level} || 1, _asterisk_agi => $_[3], _cdr_db => $_[4], _verbosity_item_level => $arg{verbosity_item_level} || 1, @@ -44,7 +44,7 @@ } sub set_verbosity_level { $_[0]->{_verbosity_level} } #Sets the verbosity level. -sub set_verbosity { $_[0]->{_verbosity_level} } #Sets the verbosity level. +sub set_verbosity { $_[0]->{_verbosity_level} } #Sets the verbosity level. One of these needs to be deprecated. sub set_astpp_db { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |