perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/xs/maps apache_functions.map modperl_functions.map
Date Fri, 04 May 2001 04:21:55 GMT
dougm       01/05/03 21:21:55

  Modified:    lib/Apache compat.pm
               src/modules/perl modperl_log.h
               t/response/TestAPI aplog.pm
               xs/Apache/Log Apache__Log.h
               xs/maps  apache_functions.map modperl_functions.map
  Log:
  add 1.x style log_error api
  
  Revision  Changes    Path
  1.4       +0 -3      modperl-2.0/lib/Apache/compat.pm
  
  Index: compat.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- compat.pm	2001/04/28 19:29:39	1.3
  +++ compat.pm	2001/05/04 04:21:48	1.4
  @@ -40,9 +40,6 @@
   sub untaint {
   }
   
  -sub warn {
  -}
  -
   package Apache::Constants;
   
   use Apache::Const ();
  
  
  
  1.5       +20 -0     modperl-2.0/src/modules/perl/modperl_log.h
  
  Index: modperl_log.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_log.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- modperl_log.h	2000/06/20 16:04:41	1.4
  +++ modperl_log.h	2001/05/04 04:21:50	1.5
  @@ -20,4 +20,24 @@
   
   void modperl_trace_level_set(const char *level);
   
  +#define modperl_log_warn(s,msg) \
  +    ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, s, "%s", msg)
  +
  +#define modperl_log_error(s,msg) \
  +    ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, s, "%s", msg)
  +
  +#define modperl_log_notice(s,msg) \
  +    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, s, "%s", msg)
  +
  +#define modperl_log_debug(s,msg) \
  +    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, s, "%s", msg)
  +
  +#define modperl_log_reason(r,msg,file) \
  +    ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, r->server, \
  +                 "access to %s failed for %s, reason: %s", \
  +                 file, \
  +                 get_remote_host(r->connection, \
  +                 r->per_dir_config, REMOTE_NAME), \
  +                 msg)
  +
   #endif /* MODPERL_LOG_H */
  
  
  
  1.5       +3 -0      modperl-2.0/t/response/TestAPI/aplog.pm
  
  Index: aplog.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/aplog.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- aplog.pm	2001/05/03 23:46:03	1.4
  +++ aplog.pm	2001/05/04 04:21:51	1.5
  @@ -46,6 +46,9 @@
       $r->log_rerror(Apache::LOG_MARK, Apache::LOG_DEBUG|Apache::LOG_NOERRNO,
                      APR::ENOTIME, "log_rerror test ok");
   
  +    $r->log_error('$r->log_error test ok');
  +    $s->log_error('$s->log_error test ok');
  +
       $s->loglevel(Apache::LOG_INFO);
       $slog->debug(sub { die "set loglevel no workie" });
   
  
  
  
  1.6       +63 -1     modperl-2.0/xs/Apache/Log/Apache__Log.h
  
  Index: Apache__Log.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/Log/Apache__Log.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Apache__Log.h	2001/05/03 23:46:05	1.5
  +++ Apache__Log.h	2001/05/04 04:21:52	1.6
  @@ -183,7 +183,7 @@
       });
   }
   
  -static XS(MPXS_Apache__Log_log_error)
  +static XS(MPXS_Apache__Log_log_xerror)
   {
       dXSARGS;
       SV *msgsv = Nullsv;
  @@ -235,6 +235,68 @@
       }
   
       SvREFCNT_dec(msgsv);
  +
  +    XSRETURN_EMPTY;
  +}
  +
  +static XS(MPXS_Apache__Log_log_error)
  +{
  +    dXSARGS;
  +    request_rec *r = NULL;
  +    server_rec *s = NULL;
  +    int i=0;
  +    char *errstr = NULL;
  +    SV *sv = Nullsv;
  +    STRLEN n_a;
  +
  +    if ((items > 1) &&
  +        (r = modperl_xs_sv2request_rec(aTHX_ ST(0),
  +                                       "Apache::RequestRec", cv)))
  +    {
  +        s = r->server;
  +        i=1;
  +    }
  +    else if ((items > 1) && sv_isa(ST(0), "Apache::Server")) {
  +        s = (server_rec *)SvObjIV(ST(0));
  +        i=1;    
  +    }
  +    else {
  +        if (r) {
  +            s = r->server;
  +        }
  +        else {
  +#if 0
  +            /*XXX*/
  +            s = perl_get_startup_server();
  +#endif
  +        }
  +    }
  +
  +    if (!s) {
  +        Perl_croak(aTHX_ "%s::%s no server_rec!", mpxs_cv_name());
  +    }
  +
  +    if (items > 1+i) {
  +        sv = newSV(0);
  +        do_join(sv, &PL_sv_no, MARK+i, SP); /* $sv = join '', @_[1..$#_] */
  +        errstr = SvPV(sv,n_a);
  +    }
  +    else {
  +        errstr = SvPV(ST(i),n_a);
  +    }
  +
  +    switch (*GvNAME(CvGV(cv))) {
  +        case 'w':
  +        modperl_log_warn(s, errstr);
  +        break;
  +        default:
  +        modperl_log_error(s, errstr);
  +        break;
  +    }
  +
  +    if (sv) {
  +        SvREFCNT_dec(sv);
  +    }
   
       XSRETURN_EMPTY;
   }
  
  
  
  1.18      +1 -1      modperl-2.0/xs/maps/apache_functions.map
  
  Index: apache_functions.map
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/maps/apache_functions.map,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- apache_functions.map	2001/05/03 06:20:59	1.17
  +++ apache_functions.map	2001/05/04 04:21:53	1.18
  @@ -149,7 +149,7 @@
   
   MODULE=Apache::Log   PACKAGE=guess
   ?ap_log_assert
  - ap_log_error
  +~ap_log_error
   -ap_log_perror
    ap_log_pid
   ~ap_log_rerror
  
  
  
  1.13      +9 -8      modperl-2.0/xs/maps/modperl_functions.map
  
  Index: modperl_functions.map
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- modperl_functions.map	2001/05/03 23:46:07	1.12
  +++ modperl_functions.map	2001/05/04 04:21:54	1.13
  @@ -44,16 +44,17 @@
   DEFINE_crit   | MPXS_Apache__Log_dispatch | ...
   
   PACKAGE=Apache::RequestRec
  -SV *:DEFINE_log | | SV *:obj
  -SV *:DEFINE_log_rerror | MPXS_Apache__Log_log_error | ...
  +SV *:DEFINE_log   | | SV *:obj
  +DEFINE_log_rerror | MPXS_Apache__Log_log_xerror | ...
  +DEFINE_log_error  | MPXS_Apache__Log_log_error  | ...
   
   PACKAGE=Apache::Server
  -SV *:DEFINE_log | | SV *:obj
  -#using `log_serror' rather than `log_error' to avoid name conflict
  -#with 1.xx version
  -SV *:DEFINE_log_serror | MPXS_Apache__Log_log_error | ...
  +SV *:DEFINE_log   | | SV *:obj
  +DEFINE_log_serror | MPXS_Apache__Log_log_xerror | ...
  +DEFINE_log_error  | MPXS_Apache__Log_log_error  | ...
  +DEFINE_warn       | MPXS_Apache__Log_log_error  | ...
   
   PACKAGE=Apache
   
  -DEFINE_LOG_MARK | MPXS_Apache_LOG_MARK | ...
  -
  +DEFINE_LOG_MARK   | MPXS_Apache_LOG_MARK       | ...
  +DEFINE_warn       | MPXS_Apache__Log_log_error | ...
  
  
  

Mime
View raw message