Log::Dispatch::Binlog::File - A subclass of L<Log::Dispatch::File> that logs


Log-Dispatch-Binlog documentation Contained in the Log-Dispatch-Binlog distribution.

Index


Code Index:

NAME

Top

Log::Dispatch::Binlog::File - A subclass of Log::Dispatch::File that logs with Storable.

SYNOPSIS

Top

	use Log::Dispatch::Binlog::File;

	my $output Log::Dispatch::Binlog::File->new(
		# Log::Dispatch::File options go here
	);

DESCRIPTION

Top

Instead of printing messages this will store all of the params to log_dispatch using nstore_fd in Storable.

SEE ALSO

Top

Log::Dispatch::File


Log-Dispatch-Binlog documentation Contained in the Log-Dispatch-Binlog distribution.

#!/usr/bin/perl

package Log::Dispatch::Binlog::File;

use strict;

use base qw(
	Log::Dispatch::File
	Log::Dispatch::Binlog::Base
);

sub log_message {
	my ( $self, %p ) = @_;

	my $fh;

	if ( $self->{close} ) {
		$self->_open_file;
		$fh = $self->{fh};
		$self->_storable_print( $fh, \%p )
			or die "Cannot write to '$self->{filename}': $!";

		close $fh
			or die "Cannot close '$self->{filename}': $!";
	} else {
		$fh = $self->{fh};
		$self->_storable_print( $fh, \%p )
			or die "Cannot write to '$self->{filename}': $!";
	}
}

__PACKAGE__

__END__