Bug 34656: Do not update real Time Holds Queue when moving from cart to shelf
[koha.git] / C4 / SIP / Trapper.pm
1 package C4::SIP::Trapper;
2
3 use Modern::Perl;
4
5 use Koha::Logger;
6
7 =head1 NAME
8
9 C4::SIP::Trapper - Module for capturing warnings for the SIP logger
10
11 =head2 TIEHANDLE
12
13     Ties the given class to this module.
14
15 =cut
16
17 sub TIEHANDLE {
18     my $class = shift;
19     bless [], $class;
20 }
21
22 =head2 PRINT
23
24     Captures warnings and directs them to Koha::Logger as well as STDERR
25
26 =cut
27
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--;
36 }
37
38 =head2 BINMODE
39
40     Suppress errors from Log::Log4perl::Appender::Screen
41
42 =cut
43
44 sub BINMODE {
45     my ( $self, $mode ) = @_;
46     binmode( STDOUT, $mode );
47 };
48
49 1;