#!perl -T
{
my
$msg
=
"This is a test message generated by the Log::Fine unit tests. Please disregard"
;
my
$log
= Log::Fine->logger(
"handlesyslog0"
);
ok(
ref
$log
eq
"Log::Fine::Logger"
);
ok(
$log
->name() =~ /\w\d+$/);
my
$handle
= Log::Fine::Handle::Syslog->new(
facility
=> LOG_USER);
ok(
$handle
->isa(
"Log::Fine::Handle"
));
ok(
$handle
->name() =~ /\w\d+$/);
ok(
$handle
->{mask} ==
$handle
->levelMap()->bitmaskAll());
ok(
$handle
->{formatter}->isa(
"Log::Fine::Formatter::Basic"
));
ok(
$handle
->{ident} eq basename $0);
ok(
$handle
->{logopts} =~ /pid/);
ok(
$handle
->{facility} == LOG_USER);
$handle
->msgWrite(INFO,
$msg
, 1);
eval
{
open
STDERR,
'>/dev/null'
;
my
$console
=
Log::Fine::Handle::Syslog->new(
facility
=> LOG_LOCAL0,
ident
=>
"badhandle"
);
close
STDERR;
};
ok(
defined
$@);
ok($@ =~ /One and _only_ one/);
}