Author: spadkins
Date: Wed Dec 12 08:34:40 2007
New Revision: 10417

Modified:
   p5ee/trunk/App-WorkQueue/lib/App/WorkQueue.pm

Log:
reworked some logging messages to use the context log instead of simple print 
statements

Modified: p5ee/trunk/App-WorkQueue/lib/App/WorkQueue.pm
==============================================================================
--- p5ee/trunk/App-WorkQueue/lib/App/WorkQueue.pm       (original)
+++ p5ee/trunk/App-WorkQueue/lib/App/WorkQueue.pm       Wed Dec 12 08:34:40 2007
@@ -459,6 +459,8 @@
     &App::sub_entry if ($App::trace);
     my ($self) = @_;
 
+    my $context = $self->{context};
+    my $db = $self->_db();
     my ($entry);
     my $STATUS_UNACQUIRED = $self->{STATUS_UNACQUIRED};
     my $STATUS_ACQUIRED   = $self->{STATUS_ACQUIRED};
@@ -478,7 +480,7 @@
                     $entry = $e;
                     $acquired = $self->_acquire_entry($entry);
                     if ($acquired) {
-                        print "ACQUIRED[M]: [", join("|",@$e), "]\n" if 
($verbose);
+                        $context->log({level=>3}, "WorkQueue : $self->{name} : 
ACQUIRED[M]: [", join("|",@$e), "]\n");
                         last;
                     }
                     else {
@@ -498,14 +500,12 @@
                     $entry = $e;
                     $acquired = $self->_acquire_entry($entry);
                     if ($acquired) {
-                        print "ACQUIRED[M]: {", join("|",%$e), "}\n" if 
($verbose);
+                        $context->log({level=>3}, "WorkQueue : $self->{name} : 
ACQUIRED[M]: [" . join("|", $e->{shop_request_id}, $e->{subrequest_id}). "]\n");
                         last;
                     }
                     else {
                         $self->_release_resources($entry);
-                        my $context = $self->{context};
-                        my $db = $self->_db();
-                        $context->log("ACQUISITION FAILED : 
shop_request_id[$entry->{shop_request_id}] : 
subrequest_id[$entry->{subrequest_id}] : 
request_status[$entry->{request_status}] : last sql stmt[$db->{sql}]\n");
+                        $context->log({level=>1}, "WorkQueue : $self->{name} : 
ACQUISITION FAILED : [$entry->{shop_request_id}|$entry->{subrequest_id}] : last 
sql stmt[$db->{sql}]\n");
                         $entry = undef;
                         # the following line appears to have been a bug
                         #$self->_maintain_queue_buffers("release",$entry);
@@ -516,7 +516,7 @@
         }
     }
 
-    print "ACQUIRED[M]: undef\n" if (!$entry && $verbose);
+    $context->log({level=>3}, "WorkQueue : $self->{name} : ACQUIRED[M]: 
undef\n") if (!$entry);
     &App::sub_exit($entry) if ($App::trace);
     return($entry);
 }

Reply via email to