Apache-Wombat
view release on metacpan or search on metacpan
lib/Apache/Wombat/FileLogger.pm view on Meta::CPAN
=item write($string)
Write the specified string to the log destination. The default
implementation does nothing. Subclasses must override this method.
B<Parameters:>
=over
=item $string
the string to write to the log destination
=back
=cut
sub write {
my $self = shift;
$self->{fh}->print("[$$] ", @_);
return 1;
}
=pod
=back
=head1 LIFECYCLE METHODS
=over
=item start()
Prepare for the beginning of active use of this Logger by opening the
file.
B<Throws:>
=over
=item B<Wombat::LifecycleException>
if the file cannot be opened
=back
=cut
sub start {
my $self = shift;
$self->SUPER::start();
# ungh dum
undef $self->{started};
$self->{fh} = Apache::LogFile->new($self->{filename}) or do {
my $msg = "cannot open $self->{filename}";
throw Wombat::LifecycleException->new($msg, $!);
};
$self->{started} = 1;
return 1;
}
=pod
=item stop()
Gracefully terminate the active use of this Logger by closing the
file.
B<Throws:>
=over
=item B<Wombat::LifecycleException>
if the file cannot be closed
=back
=cut
# sub stop {
# my $self = shift;
# $self->SUPER::stop();
# $self->{fh}->close or do {
# my $msg = "cannot close $self->{filename}";
# throw Wombat::LifecycleException->new($msg, $!);
# };
# return 1;
# }
1;
__END__
=pod
=back
=head1 SEE ALSO
L<Apache::LogFile>,
L<Servlet::Util::Exception>,
L<Wombat::Logger::LoggerBase>
=head1 AUTHOR
Brian Moseley, bcm@maz.org
=cut
( run in 0.509 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )