Koha/C4/SIP/Trapper.pm
Kyle M Hall 8cb408cf15
Bug 15253: Add POD to C4/SIP/Logger.pm and C4/SIP/Trapper.pm
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-05-12 11:47:04 +01:00

38 lines
609 B
Perl

package C4::SIP::Trapper;
use Modern::Perl;
use Koha::Logger;
=head1 NAME
C4::SIP::Trapper - Module for capturing warnings for the SIP logger
=head2 TIEHANDLE
Ties the given class to this module.
=cut
sub TIEHANDLE {
my $class = shift;
bless [], $class;
}
=head2 PRINT
Captures warnings and directs them to Koha::Logger as well as STDERR
=cut
sub PRINT {
my $self = shift;
$Log::Log4perl::caller_depth++;
my $logger =
Koha::Logger->get( { interface => 'sip', category => 'STDERR' } );
warn @_;
$logger->warn(@_);
$Log::Log4perl::caller_depth--;
}
1;