[Opensrf-commits] r1118 - trunk/src/perlmods/OpenSRF/Utils

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Oct 30 18:40:49 EDT 2007


Author: dbs
Date: 2007-10-30 18:26:11 -0400 (Tue, 30 Oct 2007)
New Revision: 1118

Modified:
   trunk/src/perlmods/OpenSRF/Utils/Logger.pm
Log:
Make Logger a little more robust by setting a default loglevel
and ensuring that we don't try to regex an undefined value.


Modified: trunk/src/perlmods/OpenSRF/Utils/Logger.pm
===================================================================
--- trunk/src/perlmods/OpenSRF/Utils/Logger.pm	2007-10-29 12:23:31 UTC (rev 1117)
+++ trunk/src/perlmods/OpenSRF/Utils/Logger.pm	2007-10-30 22:26:11 UTC (rev 1118)
@@ -1,4 +1,5 @@
 package OpenSRF::Utils::Logger;
+# vim:ts=4:noet:
 use strict;
 use vars qw($AUTOLOAD @EXPORT_OK %EXPORT_TAGS);
 use Exporter;
@@ -29,7 +30,7 @@
 %EXPORT_TAGS = ( level => [ qw/ NONE ERROR WARN INFO DEBUG INTERNAL / ], logger => [ '$logger' ] );
 
 my $config;							# config handle
-my $loglevel;						# global log level
+my $loglevel = INFO();				# global log level
 my $logfile;						# log file
 my $facility;						# syslog facility
 my $actfac;							# activity log syslog facility
@@ -101,8 +102,12 @@
         $actfile = $config->bootstrap->actlog || $config->bootstrap->logfile;
     }
 
-
-	$isclient = (OpenSRF::Utils::Config->current->bootstrap->client =~ /^true$/iog) ?  1 : 0;
+	my $client = OpenSRF::Utils::Config->current->bootstrap->client();
+	if (!$client) {
+		$isclient = 0;
+		return;
+	}
+	$isclient = ($client =~ /^true$/iog) ?  1 : 0;
 }
 
 sub _fac_to_const {



More information about the opensrf-commits mailing list