[Cpan-forum-commit] rev 271 - in trunk: . lib/CPAN

svn at pti.co.il svn at pti.co.il
Fri Jul 20 17:44:59 EEST 2007


Author: gabor
Date: 2007-07-20 17:44:59 +0300 (Fri, 20 Jul 2007)
New Revision: 271

Modified:
   trunk/
   trunk/lib/CPAN/Forum.pm
Log:
include filename and line number in logging, replace time



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4255
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752
   + 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4257
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752

Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm	2007-07-20 14:44:48 UTC (rev 270)
+++ trunk/lib/CPAN/Forum.pm	2007-07-20 14:44:59 UTC (rev 271)
@@ -8,7 +8,7 @@
 use CGI::Application::Plugin::Session;
 use CGI::Application::Plugin::LogDispatch;
 use Data::Dumper qw();
-use POSIX qw(strftime);
+use POSIX        qw();
 use Mail::Sendmail qw(sendmail);
 use CGI ();
 use List::MoreUtils qw(any);
@@ -26,7 +26,6 @@
     "ERR open_code_without_closing" => "open <code> tag without closing tag",
 );
 
-
 =head1 NAME
 
 CPAN::Forum - Web forum application to discuss CPAN modules
@@ -460,12 +459,16 @@
 
 sub _logger {
     my ($self, %h) = @_;
-    return sprintf "[%s] - %s - [%s] [%s] [%s] %s\n",
-            scalar(localtime), 
+    my ($package, $filename, $line, $sub) = caller(6);
+    my $root = $self->param("ROOT");
+    $filename =~ s/^$root//;
+    return sprintf "[%s] - %s - [%s] [%s] [%s] [%s(%s)] %s\n",
+            POSIX::strftime("%Y-%m-%d %H:%M:%S", localtime), 
             $h{level}, 
             ($ENV{REMOTE_ADDR} || ''),
             ($ENV{HTTP_REFERER} || ''),
             ($self->param('REQUEST')),
+            $filename, $line,
             $h{message};
             # keys of the hash: level, message, name
 }
@@ -740,7 +743,7 @@
             thread       => ($thread_count > 1 ? 1 : 0),
             thread_id    => $post->thread,
             thread_count => $thread_count-1,
-            #date         => strftime("%e/%b", localtime $post->date),
+            #date         => POSIX::strftime("%e/%b", localtime $post->date),
             date         => scalar localtime $post->date,
             postername   => $post->uid->username,
             };



More information about the Cpan-forum-commit mailing list