0bd73580aa
Changelog diff is: diff --git a/Changes b/Changes index b732829..0a53712 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,9 @@ Revision history for Perl extension Log-Mini {{$NEXT}} +0.1.1 2019-03-19T20:44:04Z + - Error in the constructor was fixed. 0.1.0 removed from CPAN. + 0.1.0 2019-03-19T12:08:23Z - Supports formatted with sprintf messages - log method was added
38 lines
523 B
Perl
38 lines
523 B
Perl
package Log::Mini::LoggerFILE;
|
|
|
|
use strict;
|
|
use warnings;
|
|
use IO::Handle;
|
|
|
|
|
|
use base 'Log::Mini::LoggerBase';
|
|
|
|
sub new {
|
|
my $self = shift->SUPER::new(@_);
|
|
my (%params) = @_;
|
|
|
|
$self->{file} = $params{file};
|
|
|
|
open my $fh, '>>', $params{file} or die $!;
|
|
if (defined $params{'synced'}) {
|
|
$fh->autoflush(1);
|
|
}
|
|
|
|
$self->{fh} = $fh;
|
|
|
|
return $self;
|
|
}
|
|
|
|
sub _print {
|
|
my $self = shift;
|
|
|
|
my $fh = $self->{fh};
|
|
print $fh @_;
|
|
}
|
|
|
|
|
|
sub DESTROY {
|
|
close shift->{'fh'};
|
|
return;
|
|
}
|
|
1;
|