]>
git.proxmox.com Git - pve-client.git/blob - PVE/APIClient/SafeSyslog.pm
1 package PVE
::APIClient
::SafeSyslog
;
9 use vars
qw($VERSION @ISA @EXPORT);
17 @EXPORT = qw(syslog initlog);
19 my $log_tag = "unknown";
21 # never log to console - thats too slow, and
22 # it corrupts the DBD database connection!
25 eval { Sys
::Syslog
::syslog
(@_); }; # ignore errors
29 my ($tag, $facility) = @_;
32 $tag = basename
($tag);
34 $tag = encode
("ascii", decode_utf8
($tag));
39 $facility = "daemon" if !$facility;
41 # never log to console - thats too slow
42 Sys
::Syslog
::setlogsock
('unix');
44 Sys
::Syslog
::openlog
($log_tag, 'pid', $facility);