2019-02-21 22:30:49 +03:00
|
|
|
# NAME
|
|
|
|
|
2019-02-21 23:23:53 +03:00
|
|
|
Log::Mini - It's a very simple logger which can log your messages to a file or STDERR.
|
2019-02-21 22:30:49 +03:00
|
|
|
|
|
|
|
# SYNOPSIS
|
|
|
|
|
|
|
|
use Log::Mini;
|
|
|
|
|
2019-04-12 01:01:37 +03:00
|
|
|
my $logger = Log::Mini->new(); #STDERR logger used by default. Error is default log level
|
2019-02-22 10:57:14 +03:00
|
|
|
$logger->error('Error message');
|
2019-02-21 23:23:53 +03:00
|
|
|
|
2019-04-12 01:01:37 +03:00
|
|
|
my $debug_logger = Log::Mini->new('stderr', level => 'debug'); #STDERR logger used by default
|
2019-02-22 10:57:14 +03:00
|
|
|
$debug_logger->error('Error message');
|
2019-02-21 23:23:53 +03:00
|
|
|
|
2019-04-12 01:01:37 +03:00
|
|
|
my $file_logger = Log::Mini->new(file => 'log_file.log');
|
2019-02-21 23:23:53 +03:00
|
|
|
$file_logger->info('message to log file');
|
|
|
|
|
|
|
|
#prevent buffered output. May slow down your application!
|
2019-04-12 01:05:57 +03:00
|
|
|
my $synced_file_logger = Log::Mini->get_logger(file => 'log_file.log', synced => 1);
|
2019-02-21 23:23:53 +03:00
|
|
|
|
2019-03-19 15:03:14 +03:00
|
|
|
#format message with sprintf
|
|
|
|
$logger->info('Message with %s %s', 'some', 'additional info');
|
|
|
|
|
|
|
|
#log method for better compatibility
|
|
|
|
$logger->log('info', 'information message');
|
2019-04-12 01:05:57 +03:00
|
|
|
|
2019-04-12 01:01:37 +03:00
|
|
|
#Null logger - drops all messages to /dev/null
|
2019-08-26 10:10:42 +03:00
|
|
|
my $logger = Log::Mini->new('null');
|
2019-04-12 01:05:57 +03:00
|
|
|
$logger->error('Error message'); #Message will be dropped
|
2019-03-19 15:03:14 +03:00
|
|
|
|
2019-02-21 22:30:49 +03:00
|
|
|
# DESCRIPTION
|
|
|
|
|
2019-02-21 23:23:53 +03:00
|
|
|
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.
|
2019-02-21 22:30:49 +03:00
|
|
|
|
|
|
|
# LICENSE
|
|
|
|
|
2019-02-21 23:23:53 +03:00
|
|
|
Copyright (C) Denis Fedoseev
|
2019-02-21 22:30:49 +03:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify
|
|
|
|
it under the same terms as Perl itself.
|
|
|
|
|
|
|
|
# AUTHOR
|
|
|
|
|
|
|
|
Denis Fedoseev <denis.fedoseev@gmail.com>
|