From: eldy <> Date: Fri, 21 May 2004 21:22:52 +0000 (+0000) Subject: Better log message in plugins. X-Git-Tag: AWSTATS_6_2_BETA~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2639eab6c9bd222fd80db08f3c99ee7b0fc366ac;p=thirdparty%2FAWStats.git Better log message in plugins. --- diff --git a/wwwroot/cgi-bin/plugins/detectrefererspam.pm b/wwwroot/cgi-bin/plugins/detectrefererspam.pm index e182e8ac..772ad200 100644 --- a/wwwroot/cgi-bin/plugins/detectrefererspam.pm +++ b/wwwroot/cgi-bin/plugins/detectrefererspam.pm @@ -16,7 +16,7 @@ use strict;no strict "refs"; #----------------------------------------------------------------------------- # PLUGIN VARIABLES #----------------------------------------------------------------------------- -my $PluginNeedAWStatsVersion="5.6"; +my $PluginNeedAWStatsVersion="6.2"; my $PluginHooksFunctions="ScanForRefererSpam"; # <----- @@ -51,7 +51,7 @@ sub Init_detectrefererspam { #-------------------------------------------------------------------- sub ScanForRefererSpam_detectrefererspam { - debug("Call to ScanForRefererSpam",5); + debug(" Plugin detectrefererspam: Call to ScanForRefererSpam",5); } diff --git a/wwwroot/cgi-bin/plugins/geoip.pm b/wwwroot/cgi-bin/plugins/geoip.pm index 391f749e..97c5f8c3 100644 --- a/wwwroot/cgi-bin/plugins/geoip.pm +++ b/wwwroot/cgi-bin/plugins/geoip.pm @@ -51,7 +51,7 @@ sub Init_geoip { # <----- # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS - debug(" InitParams=$InitParams",1); + debug(" Plugin geoip: InitParams=$InitParams",1); my $mode=$InitParams; if ($type eq 'geoippureperl') { if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE') { $mode=Geo::IP::PurePerl::GEOIP_MEMORY_CACHE(); } @@ -61,7 +61,7 @@ sub Init_geoip { else { $mode=Geo::IP::GEOIP_STANDARD(); } } %TmpDomainLookup=(); - debug(" GeoIP working in mode $type $mode",1); + debug(" Plugin geoip: GeoIP initialized in mode $type $mode",1); if ($type eq 'geoippureperl') { $gi = Geo::IP::PurePerl->new($mode); } else { @@ -85,9 +85,9 @@ sub GetCountryCodeByName_geoip { if (! $res) { $res=lc($gi->country_code_by_name($param)); $TmpDomainLookup{$param}=$res; - if ($Debug) { debug(" GetCountryCodeByName for $param: [$res]",5); } + if ($Debug) { debug(" Plugin geoip: GetCountryCodeByName for $param: [$res]",5); } } - elsif ($Debug) { debug(" GetCountryCodeByName for $param: Already resolved to $res",5); } + elsif ($Debug) { debug(" Plugin geoip: GetCountryCodeByName for $param: Already resolved to $res",5); } # -----> return $res; } @@ -104,9 +104,9 @@ sub GetCountryCodeByAddr_geoip { if (! $res) { $res=lc($gi->country_code_by_addr($param)); $TmpDomainLookup{$param}=$res; - if ($Debug) { debug(" GetCountryCodeByAddr for $param: $res",5); } + if ($Debug) { debug(" Plugin geoip: GetCountryCodeByAddr for $param: $res",5); } } - elsif ($Debug) { debug(" GetCountryCodeByAddr for $param: Already resolved to $res",5); } + elsif ($Debug) { debug(" Plugin geoip: GetCountryCodeByAddr for $param: Already resolved to $res",5); } # -----> return $res; } diff --git a/wwwroot/cgi-bin/plugins/geoipfree.pm b/wwwroot/cgi-bin/plugins/geoipfree.pm index b148cb9d..75472e50 100644 --- a/wwwroot/cgi-bin/plugins/geoipfree.pm +++ b/wwwroot/cgi-bin/plugins/geoipfree.pm @@ -48,7 +48,7 @@ sub Init_geoipfree { # <----- # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS - debug(" InitParams=$InitParams",1); + debug(" Plugin geoipfree: InitParams=$InitParams",1); %TmpDomainLookup=(); $gi = Geo::IPfree::new(); # $gi->Faster; # Do not enable Faster as the Memoize module is rarely available @@ -72,9 +72,9 @@ sub GetCountryCodeByName_geoipfree { if ($res !~ /\w\w/) { $res='ip'; } else { $res=lc($res); } $TmpDomainLookup{$param}=$res; - if ($Debug) { debug(" GetCountryCodeByName for $param: $res",5); } + if ($Debug) { debug(" Plugin geoipfree: GetCountryCodeByName for $param: $res",5); } } - elsif ($Debug) { debug(" GetCountryCodeByName for $param: Already resolved to $res",5); } + elsif ($Debug) { debug(" Plugin geoipfree: GetCountryCodeByName for $param: Already resolved to $res",5); } # -----> return $res; } @@ -93,9 +93,9 @@ sub GetCountryCodeByAddr_geoipfree { if ($res !~ /\w\w/) { $res='ip'; } else { $res=lc($res); } $TmpDomainLookup{$param}=$res; - if ($Debug) { debug(" GetCountryCodeByAddr for $param: $res",5); } + if ($Debug) { debug(" Plugin geoipfree: GetCountryCodeByAddr for $param: $res",5); } } - elsif ($Debug) { debug(" GetCountryCodeByAddr for $param: Already resolved to $res",5); } + elsif ($Debug) { debug(" Plugin geoipfree: GetCountryCodeByAddr for $param: Already resolved to $res",5); } # -----> return $res; } diff --git a/wwwroot/cgi-bin/plugins/hashfiles.pm b/wwwroot/cgi-bin/plugins/hashfiles.pm index c188c3c1..3a09201a 100644 --- a/wwwroot/cgi-bin/plugins/hashfiles.pm +++ b/wwwroot/cgi-bin/plugins/hashfiles.pm @@ -64,7 +64,7 @@ sub SearchFile_hashfiles { my ($tmp1b,$tmp2b,$tmp3b,$tmp4b,$tmp5b,$tmp6b,$tmp7b,$tmp8b,$tmp9b,$datehash,$tmp10b,$tmp11b,$tmp12b) = stat("${searchdir}$dnscachefile$filesuffix.hash"); if ($datesource && $datehash < $datesource) { $PluginHashfilesUpToDate=0; - debug(" Hash file not up to date. Will use source file $filetoload instead."); + debug(" Plugin hashfiles: Hash file not up to date. Will use source file $filetoload instead."); } else { # There is no source file or there is and hash file is up to date. We can just load hash file @@ -73,7 +73,7 @@ sub SearchFile_hashfiles { } elsif ($filetoload) { $PluginHashfilesUpToDate=0; - debug(" Hash file not found. Will use source file $filetoload instead."); + debug(" Plugin hashfiles: Hash file not found. Will use source file $filetoload instead."); } # Change calling params $_[4]=$filetoload; @@ -101,14 +101,14 @@ sub SaveHash_hashfiles { my ($filetosave,$hashtosave,$testifuptodate,$nbmaxofelemtosave,$nbofelemsaved)=@_; if (! $testifuptodate || ! $PluginHashfilesUpToDate) { $filetosave =~ s/(\.\w+)$//; $filetosave.=".hash"; - debug(" Save data ".($nbmaxofelemtosave?"($nbmaxofelemtosave records max)":"(all records)")." into hash file $filetosave"); + debug(" Plugin hashfiles: Save data ".($nbmaxofelemtosave?"($nbmaxofelemtosave records max)":"(all records)")." into hash file $filetosave"); if (! $nbmaxofelemtosave || (scalar keys %$hashtosave <= $nbmaxofelemtosave)) { # Save all hash array eval('store(\%$hashtosave, "$filetosave");'); $_[4]=scalar keys %$hashtosave; } else { - debug(" We need to resize hash to save from ".(scalar keys %$hashtosave)." to $nbmaxofelemtosave"); + debug(" Plugin hashfiles: We need to resize hash to save from ".(scalar keys %$hashtosave)." to $nbmaxofelemtosave"); # Save part of hash array my $counter=0; my %newhashtosave=(); diff --git a/wwwroot/cgi-bin/plugins/hostinfo.pm b/wwwroot/cgi-bin/plugins/hostinfo.pm index ad6a5dbd..96c9db9c 100644 --- a/wwwroot/cgi-bin/plugins/hostinfo.pm +++ b/wwwroot/cgi-bin/plugins/hostinfo.pm @@ -44,7 +44,7 @@ sub Init_hostinfo { # <----- # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS - debug(" InitParams=$InitParams",1); + debug(" Plugin hostinfo: InitParams=$InitParams",1); # -----> return ($checkversion?$checkversion:"$PluginHooksFunctions"); @@ -160,7 +160,7 @@ sub BuildFullHTMLOutput_hostinfo { # } if (! $ip) { $HostResolved=$Host; } - if ($Debug) { debug(" DirData=$DirData Host=$Host HostResolved=$HostResolved ",4); } + if ($Debug) { debug(" Plugin hostinfo: DirData=$DirData Host=$Host HostResolved=$HostResolved ",4); } my $w = new Net::XWhois Verbose=>$Debug, Cache=>$DirData, NoCache=>0, Timeout=>10, Domain=>$HostResolved; print "
\n"; diff --git a/wwwroot/cgi-bin/plugins/ipv6.pm b/wwwroot/cgi-bin/plugins/ipv6.pm index 7c195e2d..dd197fad 100644 --- a/wwwroot/cgi-bin/plugins/ipv6.pm +++ b/wwwroot/cgi-bin/plugins/ipv6.pm @@ -44,7 +44,7 @@ sub Init_ipv6 { # <----- # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS - debug(" InitParams=$InitParams",1); + debug(" Plugin ipv6: InitParams=$InitParams",1); $resolver = Net::DNS::Resolver->new; # -----> @@ -62,7 +62,7 @@ sub GetResolvedIP_ipv6 { my $ip = new Net::IP($_[0]); my $reverseip= $ip->reverse_ip(); my $query = $resolver->query($reverseip, "PTR"); - if (! defined($query)) { return; } + if (! defined($query)) { return; } my @result=split(/\s/, ($query->answer)[0]->string); return $result[4]; # -----> diff --git a/wwwroot/cgi-bin/plugins/rawlog.pm b/wwwroot/cgi-bin/plugins/rawlog.pm index 66b3729b..f2770463 100644 --- a/wwwroot/cgi-bin/plugins/rawlog.pm +++ b/wwwroot/cgi-bin/plugins/rawlog.pm @@ -44,7 +44,7 @@ sub Init_rawlog { # <----- # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS - debug(" InitParams=$InitParams",1); + debug(" Plugin rawlog: InitParams=$InitParams",1); if ($QueryString =~ /rawlog_maxlines=(\d+)/i) { $MAXLINE=&DecodeEncodedString("$1"); } else { $MAXLINE=5000; } diff --git a/wwwroot/cgi-bin/plugins/tooltips.pm b/wwwroot/cgi-bin/plugins/tooltips.pm index bc92925e..e9abb1b2 100644 --- a/wwwroot/cgi-bin/plugins/tooltips.pm +++ b/wwwroot/cgi-bin/plugins/tooltips.pm @@ -45,7 +45,7 @@ sub Init_tooltips { # <----- # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS - debug(" InitParams=$InitParams",1); + debug(" Plugin tooltips: InitParams=$InitParams",1); $TOOLTIPON=1; $TOOLTIPWIDTH=380; # Width of tooltips # -----> @@ -180,7 +180,7 @@ sub _ReadAndOutputTooltipFile { if (open(LANG,"${searchdir}tooltips_${logtype}/awstats-tt-en.txt")) { $FileLang="${searchdir}tooltips_${logtype}/awstats-tt-en.txt"; last; } } } - if ($Debug) { debug("Call to Read_Language_Tooltip [FileLang=\"$FileLang\"]"); } + if ($Debug) { debug(" Plugin tooltips: Call to Read_Language_Tooltip [FileLang=\"$FileLang\"]"); } if ($FileLang) { my $aws_PROG=ucfirst($PROG); my $aws_VisitTimeout = $VISITTIMEOUT/10000*60; diff --git a/wwwroot/cgi-bin/plugins/urlalias.pm b/wwwroot/cgi-bin/plugins/urlalias.pm index ae7467d0..55fd11b3 100644 --- a/wwwroot/cgi-bin/plugins/urlalias.pm +++ b/wwwroot/cgi-bin/plugins/urlalias.pm @@ -50,7 +50,7 @@ sub Init_urlalias { # <----- # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS - debug(" InitParams=$InitParams",1); + debug(" Plugin urlalias: InitParams=$InitParams",1); $urlinfoloaded=0; %UrlAlias=(); @UrlMatch=(); @@ -94,8 +94,8 @@ sub ShowInfoURL_urlalias { } close URLALIASFILE; close URLMATCHFILE; - debug("UrlAlias file loaded: ".(scalar keys %UrlAlias)." entries found."); - debug("UrlMatch file loaded: ".(scalar @UrlMatch)." entries found."); + debug(" Plugin urlalias: UrlAlias file loaded: ".(scalar keys %UrlAlias)." entries found."); + debug(" Plugin urlalias: UrlMatch file loaded: ".(scalar @UrlMatch)." entries found."); $urlinfoloaded=1; } if ($param) { diff --git a/wwwroot/cgi-bin/plugins/userinfo.pm b/wwwroot/cgi-bin/plugins/userinfo.pm index a7d1e5b8..208f0b81 100644 --- a/wwwroot/cgi-bin/plugins/userinfo.pm +++ b/wwwroot/cgi-bin/plugins/userinfo.pm @@ -50,7 +50,7 @@ sub Init_userinfo { # <----- # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS - debug(" InitParams=$InitParams",1); + debug(" Plugin userinfo: InitParams=$InitParams",1); $userinfoloaded=0; %UserInfo=(); # -----> @@ -81,7 +81,7 @@ sub ShowInfoUser_userinfo { # This is the fastest way to load with regexp that I know %UserInfo = map(/^([^\t]+)\t+([^\t]+)/o,); close USERINFOFILE; - debug("UserInfo file loaded: ".(scalar keys %UserInfo)." entries found."); + debug(" Plugin userinfo: UserInfo file loaded: ".(scalar keys %UserInfo)." entries found."); $userinfoloaded=1; } if ($param eq '__title__') {