[Catalyst] Redirecting the log

Ovid publiustemp-catalyst at yahoo.com
Thu Jan 12 20:43:53 CET 2006


Hi all,

I know that Catalyst::Log has instructions for using a different
logger, but rather than use a different one, I'd rather just be able to
alter one tiny piece of behavior in the current one.  Right now, the
"_flush" method is defined as follows:

  sub _flush {
      my $self = shift;
      if ( $self->abort || !$self->body ) {
          $self->abort(undef);
      }
      else {
          print( STDERR $self->body );
      }
      $self->body(undef);
  }

That "print STDERR" is causing me some difficulties.  There are other
things I would like to do with that.  What I would much rather do is
this:

  sub _flush {
      my $self = shift;
      if ( $self->abort || !$self->body ) {
          $self->abort(undef);
      }
      else {
          $self->send_to_log( $self->body );
      }
      $self->body(undef);
  }

  sub send_to_log {
      my $self = shift;
      print STDERR @_;
  }

Then, to alter that behavior, I just subclass Catalyst::Log and alter
that one method.  Before I change the code and submit a patch, is there
anything I'm missing or is there a better way of handling this?

Also, I can't recall if patches are preferred inline or as attachments.

Cheers,
Ovid

-- 
If this message is a response to a question on a mailing list, please send follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/



More information about the Catalyst mailing list