From: dbs Date: Tue, 30 Oct 2007 22:26:11 +0000 (+0000) Subject: Make Logger a little more robust by setting a default loglevel X-Git-Tag: osrf_rel_2_0_1~848 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7b452e03c4aa91e74fd54a633d8e36042443fad4;p=OpenSRF.git Make Logger a little more robust by setting a default loglevel and ensuring that we don't try to regex an undefined value. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1118 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/perlmods/OpenSRF/Utils/Logger.pm b/src/perlmods/OpenSRF/Utils/Logger.pm index 8734115..7ee1eba 100644 --- a/src/perlmods/OpenSRF/Utils/Logger.pm +++ b/src/perlmods/OpenSRF/Utils/Logger.pm @@ -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 @@ push @EXPORT_OK, '$logger'; %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 @@ sub set_config { $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 {