From 546864f8ffd155466945231e6d40eebc7900ad0b Mon Sep 17 00:00:00 2001 From: timriker Date: Wed, 12 Mar 2014 22:28:33 +0000 Subject: [PATCH] better logging from dondelelcaro git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@1943 c11ca15a-4712-0410-83d8-924469b57eb5 --- scripts/irclog2html.pl | 18 ++++++++++++++++++ src/logger.pl | 22 ++++++++++++++++------ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/scripts/irclog2html.pl b/scripts/irclog2html.pl index b19a1db..41bfa17 100755 --- a/scripts/irclog2html.pl +++ b/scripts/irclog2html.pl @@ -68,6 +68,24 @@ sub header {

IRC log for $channel on $date

+ + + + + + }; if ( $STYLE =~ /table/ ) { diff --git a/src/logger.pl b/src/logger.pl index 3ad021a..6220dcd 100644 --- a/src/logger.pl +++ b/src/logger.pl @@ -112,7 +112,7 @@ sub openLog { if ( &IsParam('logType') and $param{'logType'} =~ /DAILY/i ) { my ( $day, $month, $year ) = ( gmtime time() )[ 3, 4, 5 ]; - my $logDir = $file{log} . sprintf('%04d', $year + 1900); + my $logDir = $file{log} . sprintf('%04d', $year + 1900); unless(-d $logDir) { &status("openLog: making $logDir."); mkdir $logDir, 0755 or &status("Cannot mkdir $logDir");; @@ -178,12 +178,16 @@ sub processLog { sub DEBUG { return unless ( &IsParam('DEBUG') ); + my (undef,undef,$line,$subroutine,undef) = caller(1); - &status("${b_green}!DEBUG!$ob $_[0]"); + &status("${b_green}!DEBUG!$ob ".$subroutine.'['.$line."] $_[0]"); } sub ERROR { - &status("${b_red}!ERROR!$ob $_[0]"); + return unless ( &IsParam('DEBUG') ); + my (undef,undef,$line,$subroutine,undef) = caller(1); + + &status("${b_red}!ERROR!$ob ".$subroutine.'['.$line."] $_[0]"); } sub WARN { @@ -191,15 +195,21 @@ sub WARN { return if ( $_[0] =~ /^PERL: Subroutine \S+ redefined at/ ); - &status("${b_yellow}!WARN!$ob $_[0]"); + my ($package,$filename,$line,$subroutine,undef) = caller(1); + + &status("${b_yellow}!WARN!$ob ".$subroutine.'['.$line."] $_[0]"); } sub FIXME { - &status("${b_cyan}!FIXME!$ob $_[0]"); + my ($package,$filename,$line,$subroutine,undef) = caller(1); + + &status("${b_cyan}!FIXME!$ob ".$subroutine.'['.$line."] $_[0]"); } sub TODO { - &status("${b_cyan}!TODO!$ob $_[0]"); + my ($package,$filename,$line,$subroutine,undef) = caller(1); + + &status("${b_cyan}!TODO!$ob ".$subroutine.'['.$line."] $_[0]"); } sub VERB { -- 2.39.2