From 7b452e03c4aa91e74fd54a633d8e36042443fad4 Mon Sep 17 00:00:00 2001 From: dbs Date: Tue, 30 Oct 2007 22:26:11 +0000 Subject: [PATCH] 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 --- src/perlmods/OpenSRF/Utils/Logger.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 { -- 2.43.2