The following patch takes $r->log_reason out of compat and into
the mainline API (doc patch to follow)




Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.496
diff -u -I$Id -r1.496 Changes
--- Changes	22 Sep 2004 23:22:06 -0000	1.496
+++ Changes	24 Sep 2004 19:30:15 -0000
@@ -12,6 +12,9 @@
 
 =item 1.99_17-dev
 
+$r->log_reason has been ported and moved out of Apache::compat
+[Gozer]
+
 APR::OS::thread_current renamed APR::OS::current_thread_id and
 now returns the actual thread_id instead of an object that
 needed to be dereferenced to get at the thread_id [Gozer]
Index: lib/Apache/compat.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
retrieving revision 1.122
diff -u -I$Id -r1.122 compat.pm
--- lib/Apache/compat.pm	16 Sep 2004 16:36:28 -0000	1.122
+++ lib/Apache/compat.pm	24 Sep 2004 19:30:18 -0000
@@ -597,8 +597,6 @@
     #XXX resolve '.' in @INC to basename $r->filename
 }
 
-*log_reason = \&log_error;
-
 #XXX: would like to have a proper implementation
 #that reads line-by-line as defined by $/
 #the best way will probably be to use perlio in 5.8.0
Index: src/modules/perl/modperl_log.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_log.h,v
retrieving revision 1.14
diff -u -I$Id -r1.14 modperl_log.h
--- src/modules/perl/modperl_log.h	16 Jun 2004 03:55:47 -0000	1.14
+++ src/modules/perl/modperl_log.h	24 Sep 2004 19:30:18 -0000
@@ -38,8 +38,8 @@
     ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, \
                  "access to %s failed for %s, reason: %s", \
                  file, \
-                 get_remote_host(r->connection, \
-                 r->per_dir_config, REMOTE_NAME), \
+                 ap_get_remote_host(r->connection, \
+                 r->per_dir_config, REMOTE_NAME, NULL), \
                  msg)
 
 #endif /* MODPERL_LOG_H */
Index: t/response/TestAPI/aplog.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/aplog.pm,v
retrieving revision 1.20
diff -u -I$Id -r1.20 aplog.pm
--- t/response/TestAPI/aplog.pm	17 Sep 2004 00:07:43 -0000	1.20
+++ t/response/TestAPI/aplog.pm	24 Sep 2004 19:30:18 -0000
@@ -28,7 +28,7 @@
     my $r = shift;
     my $s = $r->server;
 
-    plan $r, tests => (@LogLevels * 2) + 17;
+    plan $r, tests => (@LogLevels * 2) + 19;
 
     my $logdiff = TestCommon::LogDiff->new($path);
 
@@ -104,6 +104,21 @@
         ok t_cmp $logdiff->diff,
             qr/\[error\] \$s->log_error test/,
             '$s->log_error(...)';
+    }
+    
+    # log_reason
+    {
+        t_server_log_error_is_expected();
+        $r->log_reason('$r->log_reason test');
+        ok t_cmp $logdiff->diff,
+            qr/\[error\] access to.*failed.*reason: \$r->log_reason test/,
+            '$r->log_reason(msg)';
+        
+        t_server_log_error_is_expected();
+        $r->log_reason('$r->log_reason filename test','filename');
+        ok t_cmp $logdiff->diff,
+            qr/\[error\] access to filename failed.*\$r->log_reason filename test/,
+            '$r->log_reason(msg, filename)';
     }
 
     # XXX: at the moment we can't change loglevel after server startup
Index: todo/release
===================================================================
RCS file: /home/cvs/modperl-2.0/todo/release,v
retrieving revision 1.63
diff -u -I$Id -r1.63 release
--- todo/release	22 Sep 2004 23:22:06 -0000	1.63
+++ todo/release	24 Sep 2004 19:30:18 -0000
@@ -4,10 +4,6 @@
 
 -- see also todo/api_status
 
-* $r->log_reason:
-  just add to compat
-  owner: stas
-
 * APR::Finfo constants: APR::FILETYPE_* and APR::FILEPROT_* will
   probably be APR::FTYPE_* and APR::FPROT_*
   will know exactly once libapr is fixed
Index: xs/maps/modperl_functions.map
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v
retrieving revision 1.88
diff -u -I$Id -r1.88 modperl_functions.map
--- xs/maps/modperl_functions.map	16 Sep 2004 16:36:29 -0000	1.88
+++ xs/maps/modperl_functions.map	24 Sep 2004 19:30:18 -0000
@@ -124,6 +124,7 @@
 DEFINE_log_rerror | MPXS_Apache__Log_log_xerror | ...
 DEFINE_log_error  | MPXS_Apache__Log_log_error  | ...
 DEFINE_warn       | MPXS_Apache__Log_log_error  | ...
+DEFINE_log_reason | modperl_log_reason | request_rec *:r, char *:msg, char *:file=r->uri
 
 PACKAGE=Apache::ServerRec
 SV *:DEFINE_log   | | SV *:obj

Attachment: signature.asc
Description: OpenPGP digital signature



Reply via email to