[pve-devel] r4955 - pve-common/trunk

svn-commits at proxmox.com svn-commits at proxmox.com
Tue Aug 10 09:23:54 CEST 2010


Author: dietmar
Date: 2010-08-10 07:23:54 +0000 (Tue, 10 Aug 2010)
New Revision: 4955

Added:
   pve-common/trunk/SafeSyslog.pm
Modified:
   pve-common/trunk/Makefile
Log:
add SafeSyslog.pm


Modified: pve-common/trunk/Makefile
===================================================================
--- pve-common/trunk/Makefile	2010-08-10 07:21:27 UTC (rev 4954)
+++ pve-common/trunk/Makefile	2010-08-10 07:23:54 UTC (rev 4955)
@@ -19,6 +19,7 @@
 
 LIB_SOURCES=			\
 	JSONSchema.pm		\
+	SafeSyslog.pm		\
 	Exception.pm
 
 all: ${DEB}

Added: pve-common/trunk/SafeSyslog.pm
===================================================================
--- pve-common/trunk/SafeSyslog.pm	                        (rev 0)
+++ pve-common/trunk/SafeSyslog.pm	2010-08-10 07:23:54 UTC (rev 4955)
@@ -0,0 +1,33 @@
+package PVE::SafeSyslog;
+
+use strict;
+use warnings;
+use Sys::Syslog ();
+
+use vars qw($VERSION @ISA @EXPORT);
+
+$VERSION = '1.00';
+
+require Exporter;
+
+ at ISA = qw(Exporter);
+
+ at EXPORT = qw(syslog initlog);
+ 
+# never log to console - thats too slow, and
+# it corrupts the DBD database connection!
+
+sub syslog {
+    eval { Sys::Syslog::syslog (@_); }; # ignore errors
+}
+
+sub initlog {
+    my ($ident, $facility) = @_;
+
+    # never log to console - thats too slow
+    Sys::Syslog::setlogsock ('unix');
+
+    Sys::Syslog::openlog ($ident, 'pid', $facility);
+}
+
+1;


Property changes on: pve-common/trunk/SafeSyslog.pm
___________________________________________________________________
Added: svn:executable
   + *




More information about the pve-devel mailing list