1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
use strict;
use warnings;
use Test::More tests => 15;
use File::Spec;
use Log::Handler;
my $rand_num = int(rand(999999));
my $logfile = File::Spec->catfile('t', "Log-Handler-$rand_num.log");
my $log = Log::Handler->new();
$log->add(file => {
filename => [ 't', "Log-Handler-$rand_num.log" ],
fileopen => 0,
reopen => 0,
filelock => 0,
mode => 'excl',
autoflush => 1,
permissions => '0664',
timeformat => '',
newline => 1,
message_layout => 'prefix [%L] %m',
maxlevel => 'debug',
minlevel => 'emergency',
die_on_errors => 1,
utf8 => 0,
debug_trace => 0,
debug_mode => 2,
debug_skip => 0,
});
ok(1, 'checking new');
ok(!-e $logfile, 'checking fileopen');
ok($log->is_debug, 'checking debug');
ok($log->is_info, 'checking info');
ok($log->is_notice, 'checking notice');
ok($log->is_warning, 'checking warning');
ok($log->is_warn, 'checking warn');
ok($log->is_error, 'checking error');
ok($log->is_err, 'checking err');
ok($log->is_critical, 'checking critical');
ok($log->is_crit, 'checking crit');
ok($log->is_alert, 'checking alert');
ok($log->is_emergency, 'checking emergency');
ok($log->is_emerg, 'checking emerg');
ok($log->is_fatal, 'checking fatal');
if (-e $logfile) {
unlink($logfile) or die $!;
}
|