Bug 7607: (follow-up) Address OPAC and limits
[koha.git] / C4 / SIP / Trapper.pm
blob8f115b59b77dbcab846ac348d38950a22039d3c5
1 package C4::SIP::Trapper;
3 use Modern::Perl;
5 use Koha::Logger;
7 =head1 NAME
9 C4::SIP::Trapper - Module for capturing warnings for the SIP logger
11 =head2 TIEHANDLE
13 Ties the given class to this module.
15 =cut
17 sub TIEHANDLE {
18 my $class = shift;
19 bless [], $class;
22 =head2 PRINT
24 Captures warnings and directs them to Koha::Logger as well as STDERR
26 =cut
28 sub PRINT {
29 my $self = shift;
30 $Log::Log4perl::caller_depth++;
31 my $logger =
32 Koha::Logger->get( { interface => 'sip', category => 'STDERR' } );
33 warn @_;
34 $logger->warn(@_);
35 $Log::Log4perl::caller_depth--;