small fixes
This commit is contained in:
parent
6cc09762db
commit
ed51b08c16
7 changed files with 77 additions and 14 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -29,3 +29,7 @@ cover_db/
|
|||
MYMETA.*
|
||||
|
||||
/Log-Mini-*
|
||||
|
||||
Log-Mini.iml
|
||||
Log-Mini.ipr
|
||||
Log-Mini.iws
|
|
@ -9,4 +9,5 @@ perl:
|
|||
- "5.22"
|
||||
- "5.24"
|
||||
- "5.26"
|
||||
- "5.28"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"abstract" : "It's new $module",
|
||||
"abstract" : "It's a very simple logger which can log your messages to a file or STDERR.",
|
||||
"author" : [
|
||||
"Denis Fedoseev <denis.fedoseev@gmail.com>"
|
||||
],
|
||||
|
@ -42,17 +42,22 @@
|
|||
},
|
||||
"runtime" : {
|
||||
"requires" : {
|
||||
"Carp" : "0",
|
||||
"List::Util" : "0",
|
||||
"Time::Moment" : "0",
|
||||
"perl" : "5.008001"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
"requires" : {
|
||||
"Capture::Tiny" : "0",
|
||||
"Test::Fatal" : "0",
|
||||
"Test::More" : "0.98"
|
||||
}
|
||||
}
|
||||
},
|
||||
"release_status" : "unstable",
|
||||
"version" : "0.01",
|
||||
"version" : "0.0.1",
|
||||
"x_serialization_backend" : "JSON::PP version 2.93",
|
||||
"x_static_install" : 1
|
||||
}
|
||||
|
|
17
README.md
17
README.md
|
@ -1,18 +1,29 @@
|
|||
# NAME
|
||||
|
||||
Log::Mini - It's new $module
|
||||
Log::Mini - It's a very simple logger which can log your messages to a file or STDERR.
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
use Log::Mini;
|
||||
|
||||
my $logger = Log::Mini->get_logger(); #STDERR logger used by default
|
||||
$logger->warn('Very important message');
|
||||
|
||||
|
||||
my $file_logger = Log::Mini->get_logger(file => 'log_file.log');
|
||||
$file_logger->info('message to log file');
|
||||
|
||||
#prevent buffered output. May slow down your application!
|
||||
my $synced_file_logger = Log::Mini->get_logger(file => 'log_file.log', synced => 1);
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Log::Mini is ...
|
||||
Log::Mini is a very simple logger which can log your messages to a file or STDERR.
|
||||
You can have a number of loggers for various log files.
|
||||
|
||||
# LICENSE
|
||||
|
||||
Copyright (C) Denis Fedoseev.
|
||||
Copyright (C) Denis Fedoseev
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the same terms as Perl itself.
|
||||
|
|
|
@ -3,10 +3,12 @@ package Log::Mini;
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Print3r::Logger::LoggerFILE;
|
||||
use Print3r::Logger::LoggerSTDERR;
|
||||
our $VERSION = "0.0.1";
|
||||
|
||||
sub get_logger {
|
||||
use Log::Mini::LoggerFILE;
|
||||
use Log::Mini::LoggerSTDERR;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my ( $type, @args ) = @_;
|
||||
|
||||
|
@ -16,7 +18,47 @@ sub get_logger {
|
|||
else {
|
||||
return Log::Mini::LoggerSTDERR->new(@args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Log::Mini - It's a very simple logger which can log your messages to a file or STDERR.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Log::Mini;
|
||||
|
||||
my $logger = Log::Mini->get_logger(); #STDERR logger used by default
|
||||
$logger->warn('Very important message');
|
||||
|
||||
|
||||
my $file_logger = Log::Mini->get_logger(file => 'log_file.log');
|
||||
$file_logger->info('message to log file');
|
||||
|
||||
#prevent buffered output. May slow down your application!
|
||||
my $synced_file_logger = Log::Mini->get_logger(file => 'log_file.log', synced => 1);
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Log::Mini is a very simple logger which can log your messages to a file or STDERR.
|
||||
You can have a number of loggers for various log files.
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
Copyright (C) Denis Fedoseev
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the same terms as Perl itself.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Denis Fedoseev <denis.fedoseev@gmail.com>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use lib 'lib';
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use Test::More 0.98;
|
||||
|
|
|
@ -7,20 +7,19 @@ use Test::Fatal;
|
|||
use Log::Mini;
|
||||
|
||||
subtest 'creates stderr logger' => sub {
|
||||
my $logger = Log::Mini->get_logger('stderr');
|
||||
my $logger = Log::Mini->new('stderr');
|
||||
|
||||
isa_ok $logger, 'Log::Mini::LoggerSTDERR';
|
||||
};
|
||||
|
||||
subtest 'creates file logger' => sub {
|
||||
my $logger = Log::Mini->get_logger('file');
|
||||
my $logger = Log::Mini->new('file');
|
||||
|
||||
isa_ok $logger, 'Log::Mini::LoggerFILE';
|
||||
};
|
||||
|
||||
subtest 'throws when unknown logger' => sub {
|
||||
# ok exception { Logger->build('unknown') };
|
||||
my $logger = Log::Mini->get_logger('unknown');
|
||||
subtest 'return STDERR on unknown logger' => sub {
|
||||
my $logger = Log::Mini->new('unknown');
|
||||
isa_ok $logger, 'Log::Mini::LoggerSTDERR';
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue