X-Git-Url: http://git.equinoxoli.org/?p=koha-equinox.git;a=blobdiff_plain;f=C4%2FSIP%2FSip.pm;h=9146ebcd77440cd883c0552b5712873563516946;hp=3f41226352df9f5e680fb52dd92a460eb5aa4cce;hb=03c03ed8cdb94cda4cfd661e3b04f97cb36d8dc4;hpb=0bb1e01a0c553c18953be9799329128700e2d42b diff --git a/C4/SIP/Sip.pm b/C4/SIP/Sip.pm index 3f41226..9146ebc 100644 --- a/C4/SIP/Sip.pm +++ b/C4/SIP/Sip.pm @@ -8,7 +8,6 @@ use strict; use warnings; use Exporter; use Encode; -use Sys::Syslog qw(syslog); use POSIX qw(strftime); use Socket qw(:crlf); use IO::Handle; @@ -21,13 +20,13 @@ use base qw(Exporter); our @EXPORT_OK = qw(y_or_n timestamp add_field maybe_add add_count denied sipbool boolspace write_msg $error_detection $protocol_version $field_delimiter - $last_response); + $last_response syslog); our %EXPORT_TAGS = ( all => [qw(y_or_n timestamp add_field maybe_add add_count denied sipbool boolspace write_msg $error_detection $protocol_version - $field_delimiter $last_response)]); + $field_delimiter $last_response syslog)]); our $error_detection = 0; our $protocol_version = 1; @@ -193,4 +192,19 @@ sub write_msg { $last_response = $msg; } +sub syslog { + my ( $level, $mask, @args ) = @_; + + my $method = + $level eq 'LOG_ERR' ? 'error' + : $level eq 'LOG_DEBUG' ? 'debug' + : $level eq 'LOG_INFO' ? 'info' + : $level eq 'LOG_WARNING' ? 'warn' + : 'error'; + + my $message = @args ? sprintf($mask, @args) : $mask; + + C4::SIP::SIPServer::get_logger()->$method($message); +} + 1;