LP#1840053 Change potentially slow log statements to subroutines user/jmerriam/use_log_subs
authorJohn Merriam <jmerriam@biblio.org>
Tue, 13 Aug 2019 15:15:51 +0000 (11:15 -0400)
committerJohn Merriam <jmerriam@biblio.org>
Tue, 13 Aug 2019 15:15:51 +0000 (11:15 -0400)
See OpenSRF LP#1824181 https://bugs.launchpad.net/opensrf/+bug/1824181

This depends on the above change which was released in OpenSRF 3.0.3 and
3.1.1.

The Evergreen code was searched for potentially slow logging statements
at log level info or above. We then changed those logging statements to
be delayed execution subroutines.

Here is some pseudocode that shows what is being done here:

$log->debug("Some text " . $some->slow_method);

would be changed to:

$log->debug(sub{return "Some text " . $some->slow_method });

In the example change above, an unnamed sub is passed to the OpenSRF
logger module and it will not be executed unless the global logging
level is set to debug or higher (the slow_method will not be called
unless it is needed for the global logging level).

********
If/when this is committed, please use delayed execution subroutines in
the future for any logging statements that could be slow. It is
recommend that any logging statements that do not consist entirely of
quoted text and/or already available scalar variables use delayed
execution subroutines.
********

Signed-off-by: John Merriam <jmerriam@biblio.org>
69 files changed:
Open-ILS/src/offline/offline.pl
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Invoice.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem/BatchUpdate.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Search.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Container.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/AuthProxy.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Booking.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/BibCommon.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/Merge.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CreditCard.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/HoldNotify.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/StatCat.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Transit.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Collections.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/EbookAPI.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/EbookAPI/OneClickdigital.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/EbookAPI/OverDrive.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Z3950.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/storage.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/FTS.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/asset.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/authority.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Event.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/AstCall.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/Circ/AutoRenew.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/StaticEmail.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm
Open-ILS/src/perlmods/lib/OpenILS/Utils/HTTPClient.pm
Open-ILS/src/perlmods/lib/OpenILS/Utils/HoldTargeter.pm
Open-ILS/src/perlmods/lib/OpenILS/Utils/ModsParser.pm
Open-ILS/src/perlmods/lib/OpenILS/Utils/RemoteAccount.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/AddedContent.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/AddedContent/OpenLibrary.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/PhoneList/Holds.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/Redirect.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/XMLRPCGateway.pm
Open-ILS/src/reporter/clark-kent.pl
Open-ILS/src/support-scripts/acq_order_reader.pl
Open-ILS/src/support-scripts/action_trigger_runner.pl.in
Open-ILS/src/support-scripts/marc_stream_importer.pl.in
Open-ILS/src/support-scripts/rollover_phone_to_print.pl

index ae97227..66d25af 100755 (executable)
@@ -152,8 +152,8 @@ sub ol_create_session {
        my $desc = $cgi->param('desc') || "";
        $seskey = time . "_${$}_" . int(rand() * 1000);
 
-       $logger->debug("offline: user ".$requestor->id.
-               " creating new session with key $seskey and description $desc");
+       $logger->debug(sub{return "offline: user ".$requestor->id.
+               " creating new session with key $seskey and description $desc" });
 
        $SES->create(
                {       
@@ -323,8 +323,8 @@ sub ol_status {
        } elsif( $type eq 'summary' ) {
                my $session = ol_find_session();
 
-               $logger->debug("offline: retrieving summary info ".
-                       "for session ".$session->key." with completed=".$session->num_complete);
+               $logger->debug(sub{return "offline: retrieving summary info ".
+                       "for session ".$session->key." with completed=".$session->num_complete });
 
                my $count = 0;
                $count += $_->count for ($session->scripts);
@@ -575,7 +575,7 @@ sub ol_process_commands {
                ol_append_result($res, $last);
                $session->num_complete( $session->num_complete + 1 );
 
-               $logger->debug("offline: set session [".$session->key."] num_complete to ".$session->num_complete);
+               $logger->debug(sub{return "offline: set session [".$session->key."] num_complete to ".$session->num_complete });
        }
 
        $session->end_time(CORE::time);
@@ -595,8 +595,8 @@ sub ol_handle_inhouse {
        my $count               = $command->{count} || 1;
        my $use_time    = $command->{use_time} || "";
 
-       $logger->activity("offline: in_house_use : requestor=". $requestor->id.", realtime=$realtime, ".  
-               "workstation=$ws, barcode=$barcode, count=$count, use_time=$use_time");
+       $logger->activity(sub{return "offline: in_house_use : requestor=". $requestor->id.", realtime=$realtime, ".  
+               "workstation=$ws, barcode=$barcode, count=$count, use_time=$use_time" });
 
        if( $count > 99 ) {
                return OpenILS::Event->new(
@@ -631,9 +631,9 @@ sub ol_circ_args_from_command {
        my $due_date    = $command->{due_date} || "";
        my $noncat              = ($command->{noncat}) ? "yes" : "no"; # for logging
 
-       $logger->activity("offline: $type : requestor=". $requestor->id.
+       $logger->activity(sub{return "offline: $type : requestor=". $requestor->id.
                ", realtime=$realtime, workstation=$ws, checkout_time=$cotime, ".
-               "patron=$pbc, due_date=$due_date, noncat=$noncat");
+               "patron=$pbc, due_date=$due_date, noncat=$noncat" });
 
 
        my $args = { 
@@ -733,7 +733,7 @@ sub ol_handle_checkout {
                 $skip_barcode_for_status_changed{$barcode} = 1;
             }
         } else {
-            $logger->activity("No skip check: barcode=$barcode seen_barcode=".$seen_barcode{$1}." status_changed_time=".$c->status_changed_time." ou_setting=".ol_get_org_setting('circ.offline.skip_checkout_if_newer_status_changed_time'));
+            $logger->activity(sub{return "No skip check: barcode=$barcode seen_barcode=".$seen_barcode{$1}." status_changed_time=".$c->status_changed_time." ou_setting=".ol_get_org_setting('circ.offline.skip_checkout_if_newer_status_changed_time') });
         }
         if ($skip_barcode_for_status_changed{$barcode}) {
             $logger->activity("offline: ol_handle_checkout: barcode=$barcode has SKIP_ASSET_CHANGED");
@@ -796,7 +796,7 @@ sub ol_handle_renew {
                 $skip_barcode_for_status_changed{$barcode} = 1;
             }
         } else {
-            $logger->activity("No skip check: barcode=$barcode seen_barcode=".$seen_barcode{$1}." status_changed_time=".$c->status_changed_time." ou_setting=".ol_get_org_setting('circ.offline.skip_renew_if_newer_status_changed_time'));
+            $logger->activity(sub{return "No skip check: barcode=$barcode seen_barcode=".$seen_barcode{$1}." status_changed_time=".$c->status_changed_time." ou_setting=".ol_get_org_setting('circ.offline.skip_renew_if_newer_status_changed_time') });
         }
         if ($skip_barcode_for_status_changed{$barcode}) {
             $logger->activity("offline: ol_handle_renew: barcode=$barcode has SKIP_ASSET_CHANGED");
@@ -822,8 +822,8 @@ sub ol_handle_checkin {
        my $barcode             = $command->{barcode};
        my $backdate    = $command->{backdate} || "";
 
-       $logger->activity("offline: checkin : requestor=". $requestor->id.
-               ", realtime=$realtime, ".  "workstation=$ws, barcode=$barcode, backdate=$backdate");
+       $logger->activity(sub{return "offline: checkin : requestor=". $requestor->id.
+               ", realtime=$realtime, ".  "workstation=$ws, barcode=$barcode, backdate=$backdate" });
 
     if( $barcode ) {
 
@@ -853,7 +853,7 @@ sub ol_handle_checkin {
                 $skip_barcode_for_status_changed{$barcode} = 1;
             }
         } else {
-            $logger->activity("No skip check: barcode=$barcode seen_barcode=".$seen_barcode{$1}." status_changed_time=".$c->status_changed_time." ou_setting=".ol_get_org_setting('circ.offline.skip_checkin_if_newer_status_changed_time'));
+            $logger->activity(sub{return "No skip check: barcode=$barcode seen_barcode=".$seen_barcode{$1}." status_changed_time=".$c->status_changed_time." ou_setting=".ol_get_org_setting('circ.offline.skip_checkin_if_newer_status_changed_time') });
         }
         if ($skip_barcode_for_status_changed{$barcode}) {
             $logger->activity("offline: ol_handle_checkin: barcode=$barcode has SKIP_ASSET_CHANGED");
@@ -912,7 +912,7 @@ sub ol_handle_register {
                $sr->isnew(1);
                $sr->usr(-1);
                push(@sresp, $sr);
-               $logger->debug("offline: created new survey response for survey ".$sr->survey);
+               $logger->debug(sub{return "offline: created new survey response for survey ".$sr->survey });
        }
        delete $command->{user}->{survey_responses};
        $actor->survey_responses(\@sresp) if @sresp;
@@ -927,7 +927,7 @@ sub ol_handle_register {
                $billing_address->id(-1);
                $billing_address->usr(-1);
                delete $command->{user}->{billing_address};
-               $logger->debug("offline: read billing address ".$billing_address->street1);
+               $logger->debug(sub{return "offline: read billing address ".$billing_address->street1 });
        }
 
     my $mid = undef;
@@ -940,14 +940,14 @@ sub ol_handle_register {
                    $mailing_address->isnew(1);
                    $mailing_address->id(-2);
                    $mailing_address->usr(-1);
-                   $logger->debug("offline: read mailing address ".$mailing_address->street1);
+                   $logger->debug(sub{return "offline: read mailing address ".$mailing_address->street1 });
         } elsif (!$webclient) {
                    $mailing_address = Fieldmapper::actor::user_address->new;
                    $mailing_address->$_($addr->{$_}) for keys %$addr;
                    $mailing_address->isnew(1);
                    $mailing_address->id(-2);
                    $mailing_address->usr(-1);
-                   $logger->debug("offline: read mailing address ".$mailing_address->street1);
+                   $logger->debug(sub{return "offline: read mailing address ".$mailing_address->street1 });
         }
                delete $command->{user}->{mailing_address};
        }
@@ -972,7 +972,7 @@ sub ol_handle_register {
                $addr->isnew(1);
        $addr->id($aid);
            $addr->usr(-1);
-       $logger->debug("offline: read other address ".$addr->street1);
+       $logger->debug(sub{return "offline: read other address ".$addr->street1 });
         $aid--;
         push( @{$actor->addresses}, $addr );
     }
index 49feb96..fe32900 100644 (file)
@@ -89,10 +89,10 @@ sub retrieve_core {
     foreach my $account (@$set) {
         my $count = 0;
         my $server;
-        $logger->info(
+        $logger->info(sub{return
             "EDI check for vendor " .
             ++$vcount . " of " . scalar(@$set) . ": " . $account->host
-        );
+        });
         unless ($server = __PACKAGE__->remote_account($account)) { # assignment
             $logger->err(
                 sprintf "Failed remote account mapping for %s (%s)",
@@ -114,7 +114,7 @@ sub retrieve_core {
 
         my @files    = ($server->ls({remote_file => ($account->in_dir || './')}));
         my @ok_files = grep {$_ !~ /\/\.?\.$/ and $_ ne '0'} @files;
-        $logger->info(sprintf "%s of %s files at %s/%s", scalar(@ok_files), scalar(@files), $account->host, $account->in_dir || "");   
+        $logger->info(sub{return sprintf "%s of %s files at %s/%s", scalar(@ok_files), scalar(@files), $account->host, $account->in_dir || "" });   
 
         foreach my $remote_file (@ok_files) {
             my $description = sprintf "%s/%s", $account->host, $remote_file;
@@ -164,10 +164,10 @@ sub retrieve_core {
                 last;
             }
 
-            $logger->info(
+            $logger->info(sub{return
                 sprintf "%s of %s targets: %s",
                     $count, scalar(@ok_files), $description
-            );
+            });
             printf("%d of %d targets: %s\n", $count, scalar(@ok_files), $description);
             if ($test) {
                 push @return, "test_$count";
@@ -230,8 +230,8 @@ sub process_retrieval {
                 $logger->warn("EDI: PO identifier is non-numeric. Blanking and continuing.");
                 undef $msg_hash->{purchase_order};
             } else {
-                $logger->info("EDI: processing message for PO " .
-                    $msg_hash->{purchase_order});
+                $logger->info(sub{return "EDI: processing message for PO " .
+                    $msg_hash->{purchase_order} });
                 $incoming->purchase_order($msg_hash->{purchase_order});
                 unless ($e->retrieve_acq_purchase_order(
                         $incoming->purchase_order)) {
@@ -329,7 +329,7 @@ sub send_core {
             # For outbound files, sending is the end of processing on
             # the EG side.
 
-            $logger->info("Sent message (id " . $_->id. ") via $log_str");
+            $logger->info(sub{return "Sent message (id " . $_->id. ") via $log_str" });
         } else {
             $logger->error(
                 "(S)FTP put to $log_str FAILED: " .
@@ -560,14 +560,14 @@ sub process_message_buyer {
                     # it with cstore later.
                     $message->account($other_accounts->[0]->id);
 
-                    $logger->info(
+                    $logger->info(sub{return
                         $log_prefix . sprintf(
                             "changing edi_account from %d to %d based on " .
                             "vendcode '%s' (%d match(es))",
                             $orig_acct->id, $message->account, $vendcode,
                             scalar(@$other_accounts)
                         )
-                    );
+                    });
 
                     # If we've updated the message's account, and if we're
                     # dealing with an invoice, we should update the invoice's
@@ -599,14 +599,14 @@ sub process_message_buyer {
                     );
                 }
 
-                $logger->info(
+                $logger->info(sub{return
                     $log_prefix . sprintf(
                         "changing edi_account from %d to %d based on " .
                         "vendacct '%s' (%d match(es))",
                         $message->account, $accts->[0]->id, $buyer,
                         scalar(@$accts)
                     )
-                );
+                });
 
                 # Both $message and $eg_inv should be saved later by the caller.
                 $message->account($accts->[0]->id);
@@ -1114,9 +1114,9 @@ sub create_acq_invoice_from_edi {
         push @$eg_inv_items, $eg_inv_item;
     }
 
-    $logger->info($log_prefix . 
+    $logger->info(sub{return $log_prefix . 
         sprintf("creating invoice with %d entries and %d items.",
-            scalar(@$eg_inv_entries), scalar(@$eg_inv_items)));
+            scalar(@$eg_inv_entries), scalar(@$eg_inv_items)) });
 
     $e->xact_begin;
 
index 78765c6..fbf0bf0 100644 (file)
@@ -466,10 +466,10 @@ sub uncancel_copies_as_needed {
         my $lid = $e->retrieve_acq_lineitem_detail($lid_id);
         next unless $lid->cancel_reason;
 
-        $logger->info(
+        $logger->info(sub{return
             "un-cancelling invoice lineitem " . $li->id .
             " lineitem_detail " . $lid_id
-        );
+        });
         $lid->clear_cancel_reason;
         return $e->die_event unless $e->update_acq_lineitem_detail($lid);
     }
index a12052c..74b9b89 100644 (file)
@@ -271,10 +271,10 @@ sub lineitem_batch_update_impl {
     }
 
     $conn->status(new OpenSRF::DomainObject::oilsContinueStatus);
-    $logger->info(
+    $logger->info(sub{return
         "lineitem_batch_update_impl() working with " .
         scalar(@$lineitems) . " lineitems"
-    );
+    });
 
     my $item_count = pick_winning_item_count($changes, $dist_formula);
     adjust_lineitem_copy_counts($lineitems, $item_count) if defined $item_count;
index 331baf2..f7c929e 100644 (file)
@@ -453,7 +453,7 @@ sub import_li_bibs_via_vandelay {
     # add the already-imported records to the response list
     push(@{$res->{li_ids}}, grep { $_ != @$needs_importing } @$li_ids);
 
-    $logger->info("acq-vl: processing recs via Vandelay with args: ".Dumper($vandelay));
+    $logger->info(sub{return "acq-vl: processing recs via Vandelay with args: ".Dumper($vandelay) });
 
     my $vl_stat = test_vandelay_import_args($vandelay, scalar(@$non_queued));
     if ($vl_stat == 0) {
@@ -515,7 +515,7 @@ sub import_li_bibs_via_vandelay {
         push(@lis, $li);
     }
 
-    $logger->info("acq-vl: created vandelay records [@vqbr_ids]");
+    $logger->info(sub{return "acq-vl: created vandelay records [@vqbr_ids]" });
 
     # we have to commit the transaction now since 
     # vandelay uses its own transactions.
@@ -562,7 +562,7 @@ sub import_li_bibs_via_vandelay {
     }
 
     $ses->kill_me;
-    $logger->info("acq-vl: successfully imported lineitems [@success_lis]");
+    $logger->info(sub{return "acq-vl: successfully imported lineitems [@success_lis]" });
 
     # add the successfully imported lineitems to the already-imported lineitems
     push (@{$res->{li_ids}}, @success_lis);
@@ -1045,7 +1045,7 @@ sub fund_exceeds_balance_percent {
             $allocations == 0 || # if no allocations were ever made, assume we have hit the stop percent
             ((($allocations - $balance + $debit_amount) / $allocations) * 100) > $fund->$method_name
         ) {
-            $logger->info("fund would hit a limit: " . $fund->id . ", $balance, $debit_amount, $allocations, $method_name");
+            $logger->info(sub{return "fund would hit a limit: " . $fund->id . ", $balance, $debit_amount, $allocations, $method_name" });
             $e->event(
                 new OpenILS::Event(
                     $event_name,
@@ -1943,7 +1943,7 @@ sub apply_default_copies {
 
     my $copy_count = $provider->default_copy_count || return 1;
     
-    $logger->info("Applying $copy_count default copies for PO ".$po->id);
+    $logger->info(sub{return "Applying $copy_count default copies for PO ".$po->id });
 
     my $li_ids = $li_id ? [$li_id] : 
         $e->search_acq_lineitem({
@@ -3195,7 +3195,7 @@ sub cancel_lineitem {
             $mgr->editor, $override, undef, $copies, $delete_stats, $retarget_holds,$force_delete_empty_bib);
 
         if( $cat_evt ) {
-            $logger->info("fleshed copy update failed with event: ".OpenSRF::Utils::JSON->perl2JSON($cat_evt));
+            $logger->info(sub{return "fleshed copy update failed with event: ".OpenSRF::Utils::JSON->perl2JSON($cat_evt) });
             return new OpenILS::Event(
                 "ACQ_NOT_CANCELABLE", "note" => "lineitem $li_id", "payload" => $cat_evt
             );
@@ -3223,8 +3223,8 @@ sub cancel_lineitem {
 
             for my $hold (@$holds) {
 
-                $logger->info("Cancelling hold ".$hold->id.
-                    " due to acq lineitem cancellation.");
+                $logger->info(sub{return "Cancelling hold ".$hold->id.
+                    " due to acq lineitem cancellation." });
 
                 $hold->cancel_time('now');
                 $hold->cancel_cause(5); # 'Staff forced'--we may want a new hold cancel cause reason for this
index c09fd35..0257415 100644 (file)
@@ -676,7 +676,7 @@ sub bib_search {
 
     $e->commit;
 
-    $logger->info("created @li_ids new lineitems for picklist $picklist");
+    $logger->info(sub{return "created @li_ids new lineitems for picklist $picklist" });
 
     # new editor, but still using transaction to ensure correct retrieval
     # in a replicated setup
index 219f611..cd2dd26 100644 (file)
@@ -452,8 +452,8 @@ sub update_patron {
     my $e = new_editor(xact => 1, authtoken => $auth);
     return $e->event unless $e->checkauth;
 
-    $logger->info($patron->isnew ? "Creating new patron..." :
-        "Updating Patron: " . $patron->id);
+    $logger->info(sub{return $patron->isnew ? "Creating new patron..." :
+        "Updating Patron: " . $patron->id });
 
     my $evt = check_group_perm($e, $e->requestor, $patron);
     return $evt if $evt;
@@ -664,7 +664,7 @@ sub _add_patron {
         {usrname => $patron->usrname}, {idlist => 1});
     return (undef, OpenILS::Event->new('USERNAME_EXISTS')) if @$ex;
 
-    $logger->info("Creating new user in the DB with username: ".$patron->usrname());
+    $logger->info(sub{return "Creating new user in the DB with username: ".$patron->usrname() });
 
     # do a dance to get the password hashed securely
     my $saved_password = $patron->passwd;
@@ -722,8 +722,8 @@ sub group_perm_failed {
 
     } while( !($perm = $grp->application_perm) and ($grpid = $grp->parent) );
 
-    $logger->info("user update checking perm $perm on user ".
-        $requestor->id." for update/create on user username=".$patron->usrname);
+    $logger->info(sub{return "user update checking perm $perm on user ".
+        $requestor->id." for update/create on user username=".$patron->usrname });
 
     return $e->allowed($perm, $patron->home_ou) ? undef : $e->die_event;
 }
@@ -733,7 +733,7 @@ sub group_perm_failed {
 sub _update_patron {
     my( $e, $patron, $noperm) = @_;
 
-    $logger->info("Updating patron ".$patron->id." in DB");
+    $logger->info(sub{return "Updating patron ".$patron->id." in DB" });
 
     my $evt;
 
@@ -765,7 +765,7 @@ sub verify_last_xact {
     my $p = $e->retrieve_actor_user($patron->id);
     my $xact = $p->last_xact_id;
     return undef unless $xact;
-    $logger->info("user xact = $xact, saving with xact " . $patron->last_xact_id);
+    $logger->info(sub{return "user xact = $xact, saving with xact " . $patron->last_xact_id });
     return OpenILS::Event->new('XACT_COLLISION')
         if $xact ne $patron->last_xact_id;
     return undef;
@@ -782,8 +782,8 @@ sub _check_dup_ident {
         ident_value => $patron->ident_value,
     };
 
-    $logger->debug("patron update searching for dup ident values: " .
-        $patron->ident_type . ':' . $patron->ident_value);
+    $logger->debug(sub{return "patron update searching for dup ident values: " .
+        $patron->ident_type . ':' . $patron->ident_value });
 
     $search->{id} = {'!=' => $patron->id} if $patron->id and $patron->id > 0;
 
@@ -885,7 +885,7 @@ sub _add_address {
     my($e, $address) = @_;
     $address->clear_id();
 
-    $logger->info("Creating new address at street ".$address->street1);
+    $logger->info(sub{return "Creating new address at street ".$address->street1 });
 
     # put the address into the database
     $e->create_actor_user_address($address) or return (undef, $e->die_event);
@@ -896,7 +896,7 @@ sub _add_address {
 sub _update_address {
     my( $e, $address ) = @_;
 
-    $logger->info("Updating address ".$address->id." in the DB");
+    $logger->info(sub{return "Updating address ".$address->id." in the DB" });
 
     $e->update_actor_user_address($address) or return (undef, $e->die_event);
 
@@ -947,7 +947,7 @@ sub _add_card {
     my( $e, $card ) = @_;
     $card->clear_id();
 
-    $logger->info("Adding new patron card ".$card->barcode);
+    $logger->info(sub{return "Adding new patron card ".$card->barcode });
 
     $e->create_actor_card($card) or return (undef, $e->die_event);
 
@@ -958,7 +958,7 @@ sub _add_card {
 # returns event on error.  returns undef otherwise
 sub _update_card {
     my( $e, $card ) = @_;
-    $logger->info("Updating patron card ".$card->id);
+    $logger->info(sub{return "Updating patron card ".$card->id });
 
     $e->update_actor_card($card) or return $e->die_event;
     return undef;
@@ -982,10 +982,10 @@ sub _add_update_waiver_entries {
             $waiver->clear_id();
             $e->create_actor_usr_privacy_waiver($waiver) or return (undef, $e->die_event);
         } elsif ($waiver->ischanged()) {
-            $logger->info("Updating patron waiver entry " . $waiver->id);
+            $logger->info(sub{return "Updating patron waiver entry " . $waiver->id });
             $e->update_actor_usr_privacy_waiver($waiver) or return (undef, $e->die_event);
         } elsif ($waiver->isdeleted()) {
-            $logger->info("Deleting patron waiver entry " . $waiver->id);
+            $logger->info(sub{return "Deleting patron waiver entry " . $waiver->id });
             $e->delete_actor_usr_privacy_waiver($waiver) or return (undef, $e->die_event);
         }
     }
@@ -997,7 +997,7 @@ sub _add_update_waiver_entries {
 sub _delete_address {
     my( $e, $address ) = @_;
 
-    $logger->info("Deleting address ".$address->id." from DB");
+    $logger->info(sub{return "Deleting address ".$address->id." from DB" });
 
     $e->delete_actor_user_address($address) or return $e->die_event;
     return undef;
@@ -1008,7 +1008,7 @@ sub _delete_address {
 sub _add_survey_responses {
     my ($e, $patron, $new_patron) = @_;
 
-    $logger->info( "Updating survey responses for patron ".$new_patron->id );
+    $logger->info(sub{return "Updating survey responses for patron ".$new_patron->id });
 
     my $responses = $patron->survey_responses;
 
@@ -2619,8 +2619,8 @@ sub register_workstation {
             if($owner ne $existing->owning_lib) {
                 # if necessary, update the owning_lib of the workstation
 
-                $logger->info("changing owning lib of workstation ".$existing->id.
-                    " from ".$existing->owning_lib." to $owner");
+                $logger->info(sub{return "changing owning lib of workstation ".$existing->id.
+                    " from ".$existing->owning_lib." to $owner" });
                 return $e->die_event unless
                     $e->allowed('UPDATE_WORKSTATION', $existing->owning_lib);
 
@@ -4202,7 +4202,7 @@ sub _reset_password_request {
         }
     });
 
-    $logger->info("User " . $user->id . " has " . $active_requests->[0]->{'usr'} . " active password reset requests.");
+    $logger->info(sub{return "User " . $user->id . " has " . $active_requests->[0]->{'usr'} . " active password reset requests." });
 
     # if less than or equal to per-user threshold, proceed; otherwise, return event
     my $aupr_per_user_limit = $U->ou_ancestor_setting_value($user->home_ou, 'circ.password_reset_request_per_user_limit') || 3;
index abeeea2..b79a75a 100644 (file)
@@ -246,8 +246,8 @@ sub bucket_retrieve_class {
         $apputils->checkses_requestor( $authtoken, $userid, 'VIEW_CONTAINER' );
     return $evt if $evt;
 
-    $logger->debug("User " . $staff->id . 
-        " retrieving buckets for user $userid [class=$class, type=$type]");
+    $logger->debug(sub{return "User " . $staff->id . 
+        " retrieving buckets for user $userid [class=$class, type=$type]" });
 
     my $meth = $types{$class} . ".search.atomic";
     my $buckets;
index 5ed0e25..0255b59 100644 (file)
@@ -42,8 +42,8 @@ sub start_db_session {
     }
     $trans_req->finish();
 
-    $logger->debug("Setting global storage session to ".
-        "session: " . $session->session_id . " : " . $session->app );
+    $logger->debug(sub{return "Setting global storage session to ".
+        "session: " . $session->session_id . " : " . $session->app });
 
     return $session;
 }
@@ -78,7 +78,7 @@ my $PERM_QUERY = {
 # returns the first failed perm on failure
 sub check_user_perms {
     my($self, $user_id, $org_id, @perm_types ) = @_;
-    $logger->debug("Checking perms with user : $user_id , org: $org_id, @perm_types");
+    $logger->debug(sub{return "Checking perms with user : $user_id , org: $org_id, @perm_types" });
 
     for my $type (@perm_types) {
         $PERM_QUERY->{select}->{au}->[0]->{params} = [$type, $org_id];
@@ -277,7 +277,7 @@ sub checkses {
 sub checksesperm {
     my( $self, $session, @perms ) = @_;
     my $user; my $evt; my $e; 
-    $logger->debug("Checking user session $session and perms @perms");
+    $logger->debug(sub{return "Checking user session $session and perms @perms" });
     ($user, $evt) = $self->checkses($session);
     return (undef, $evt) if $evt;
     $evt = $self->check_perms($user->id, $user->home_ou, @perms);
@@ -290,7 +290,7 @@ sub checkrequestor {
     my $user; my $evt;
     $userid = $staffobj->id unless defined $userid;
 
-    $logger->debug("checkrequestor(): requestor => " . $staffobj->id . ", target => $userid");
+    $logger->debug(sub{return "checkrequestor(): requestor => " . $staffobj->id . ", target => $userid" });
 
     if( $userid ne $staffobj->id ) {
         ($user, $evt) = $self->fetch_user($userid);
@@ -1024,7 +1024,7 @@ sub update_copy {
     my $editor  = $params{editor} || die "update_copy(): copy editor required";
     my $session = $params{session};
 
-    $logger->debug("Updating copy in the database: " . $copy->id);
+    $logger->debug(sub{return "Updating copy in the database: " . $copy->id });
 
     $self->unflesh_copy($copy);
     $copy->editor( $editor );
@@ -1036,7 +1036,7 @@ sub update_copy {
     $s = $session->request( $meth, $copy )->gather(1) if $session;
     $s = $self->storagereq( $meth, $copy ) unless $session;
 
-    $logger->debug("Update of copy ".$copy->id." returned: $s");
+    $logger->debug(sub{return "Update of copy ".$copy->id." returned: $s" });
 
     return $self->DB_UPDATE_FAILED($copy) unless $s;
     return undef;
@@ -1049,7 +1049,7 @@ sub update_reservation {
     my $editor      = $params{editor} || die "update_reservation(): copy editor required";
     my $session     = $params{session};
 
-    $logger->debug("Updating copy in the database: " . $reservation->id);
+    $logger->debug(sub{return "Updating copy in the database: " . $reservation->id });
 
     $self->unflesh_reservation($reservation);
 
@@ -1059,7 +1059,7 @@ sub update_reservation {
     $s = $session->request( $meth, $reservation )->gather(1) if $session;
     $s = $self->cstorereq( $meth, $reservation ) unless $session;
 
-    $logger->debug("Update of copy ".$reservation->id." returned: $s");
+    $logger->debug(sub{return "Update of copy ".$reservation->id." returned: $s" });
 
     return $self->DB_UPDATE_FAILED($reservation) unless $s;
     return undef;
@@ -1778,7 +1778,7 @@ sub fire_object_event {
             push(@event_ids, $event_id);
         }
 
-        $logger->info("EVENTS = " . OpenSRF::Utils::JSON->perl2JSON(\@event_ids));
+        $logger->info(sub{return "EVENTS = " . OpenSRF::Utils::JSON->perl2JSON(\@event_ids) });
 
         my $resp;
         if (not defined $client) {
@@ -2310,7 +2310,7 @@ sub check_open_xact {
         ( $summary->balance_owed == 0 and ! $xact->xact_finish ) and
         ( !$circ or $circ->stop_fines )) {
 
-        $logger->info("closing transaction ".$xact->id. ' because balance_owed == 0');
+        $logger->info(sub{return "closing transaction ".$xact->id. ' because balance_owed == 0' });
         $xact->xact_finish('now');
         $editor->update_money_billable_transaction($xact)
             or return $editor->event;
@@ -2320,7 +2320,7 @@ sub check_open_xact {
     # If money is owed or a refund is due on the xact and xact_finish
     # is set, clear it (to reopen the xact) and update
     if( $summary->balance_owed != 0 and $xact->xact_finish ) {
-        $logger->info("re-opening transaction ".$xact->id. ' because balance_owed != 0');
+        $logger->info(sub{return "re-opening transaction ".$xact->id. ' because balance_owed != 0' });
         $xact->clear_xact_finish;
         $editor->update_money_billable_transaction($xact)
             or return $editor->event;
index 1f7832c..2406a6a 100644 (file)
@@ -195,7 +195,7 @@ sub login {
     # check for possibility of brute-force attack
     my $fail_count = $cache->get_cache('oils_auth_' . $args->{'username'} . '_count') || 0;
     if ($fail_count >= $block_count) {
-        $logger->debug("AuthProxy found too many recent failures for '" . $args->{'username'} . "' : $fail_count, forcing failure state.");
+        $logger->debug(sub{return "AuthProxy found too many recent failures for '" . $args->{'username'} . "' : $fail_count, forcing failure state." });
         $cache->put_cache('oils_auth_' . $args->{'username'} . '_count', ++$fail_count, $block_timeout);
         return OpenILS::Event->new( 'LOGIN_FAILED' );
     }
@@ -248,7 +248,7 @@ sub login {
                     { usrname => $args->{'username'} }
                 );
                 if (!$user->[0]) {
-                    $logger->debug("Authenticated username '" . $args->{'username'} . "' has no Evergreen account, aborting");
+                    $logger->debug(sub{return "Authenticated username '" . $args->{'username'} . "' has no Evergreen account, aborting" });
                     return OpenILS::Event->new( 'LOGIN_FAILED' );
                 } else {
                     $args->{user_id} = $user->[0]->id;
index a715f88..05807a3 100644 (file)
@@ -891,10 +891,10 @@ sub could_capture {
                 if ($now >= $start_time->subtract("seconds" => $elbow_room)) {
                     $client->respond($bresv);
                 } else {
-                    $logger->info(
+                    $logger->info(sub{return
                         "not within elbow room: $elbow_room, " .
                         "else would have returned bresv " . $bresv->id
-                    );
+                    });
                 }
             }
         }
@@ -962,7 +962,7 @@ sub best_bresv_candidate {
 
     # This will almost always be the case.
     if (@$id_list == 1) {
-        $logger->info("best_bresv_candidate (only) " . $id_list->[0]);
+        $logger->info(sub{return "best_bresv_candidate (only) " . $id_list->[0] });
         return $id_list->[0];
     }
 
@@ -990,9 +990,9 @@ sub best_bresv_candidate {
     } else {
         $result = (sort @$id_list)[0];
     }
-    $logger->info(
+    $logger->info(sub{return
         "best_bresv_candidate from " . join(",", @$id_list) . ": $result"
-    );
+    });
     return $result;
 }
 
@@ -1219,12 +1219,12 @@ sub cancel_reservation {
             $bresv->target_resource_type->catalog_item == "t" &&
             $bresv->current_resource
         ) {
-            $logger->info("result of no-op checkin (upon cxl bresv) is " .
+            $logger->info(sub{return "result of no-op checkin (upon cxl bresv) is " .
                 $circ->request(
                     "open-ils.circ.checkin", $auth,
                     {"barcode" => $bresv->current_resource->barcode,
                         "noop" => 1}
-                )->gather(1)->{"textcode"});
+                )->gather(1)->{"textcode"} });
         }
         push @results, $bresv->id;
     }
index 4c4d977..5494b08 100644 (file)
@@ -63,7 +63,7 @@ sub __load_marc_templates {
     $marc_template_files = $conf->config_value(                    
         "apps", "open-ils.cat","app_settings", "marctemplates" );
 
-    $logger->info("Loaded marc templates: " . Dumper($marc_template_files));
+    $logger->info(sub{return "Loaded marc templates: " . Dumper($marc_template_files) });
 }
 
 sub _load_marc_template {
@@ -114,7 +114,7 @@ sub create_record_xml {
     my( $user_obj, $evt ) = $U->checksesperm($login, 'CREATE_MARC');
     return $evt if $evt;
 
-    $logger->activity("user ".$user_obj->id." creating new MARC record");
+    $logger->activity(sub{return "user ".$user_obj->id." creating new MARC record" });
 
     my $meth = $self->method_lookup("open-ils.cat.biblio.record.xml.import");
 
@@ -789,13 +789,13 @@ sub fleshed_copy_update {
         $editor, $oargs, undef, $copies, $delete_stats, $retarget_holds, undef, $create_parts);
 
     if( $evt ) { 
-        $logger->info("fleshed copy update failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
+        $logger->info(sub{return "fleshed copy update failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt) });
         $editor->rollback; 
         return $evt; 
     }
 
     $editor->commit;
-    $logger->info("fleshed copy update successfully updated ".scalar(@$copies)." copies");
+    $logger->info(sub{return "fleshed copy update successfully updated ".scalar(@$copies)." copies" });
     reset_hold_list($auth, $retarget_holds);
 
     return 1;
@@ -804,7 +804,7 @@ sub fleshed_copy_update {
 sub reset_hold_list {
     my($auth, $hold_ids) = @_;
     return unless @$hold_ids;
-    $logger->info("reseting holds after copy status change: @$hold_ids");
+    $logger->info(sub{return "reseting holds after copy status change: @$hold_ids" });
     my $ses = OpenSRF::AppSession->create('open-ils.circ');
     $ses->request('open-ils.circ.hold.reset.batch', $auth, $hold_ids);
 }
@@ -874,7 +874,7 @@ sub transfer_copies_to_volume {
         $editor, $oargs, undef, $fleshed_copies, $delete_stats, $retarget_holds, $force_delete_empty_bib, $create_parts);
 
     if( $evt ) { 
-        $logger->info("copy to volume transfer failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
+        $logger->info(sub{return "copy to volume transfer failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt) });
         $editor->rollback; 
         return $evt; 
     }
@@ -910,7 +910,7 @@ sub transfer_copies_to_volume {
     }
 
     $editor->commit;
-    $logger->info("copy to volume transfer successfully updated ".scalar(@$copies)." copies");
+    $logger->info(sub{return "copy to volume transfer successfully updated ".scalar(@$copies)." copies" });
     reset_hold_list($auth, $retarget_holds);
 
     return 1;
@@ -1144,7 +1144,7 @@ sub fleshed_volume_update {
     my $copy_ids = [];
 
     for my $vol (@$volumes) {
-        $logger->info("vol-update: investigating volume ".$vol->id);
+        $logger->info(sub{return "vol-update: investigating volume ".$vol->id });
 
         $vol->editor($reqr->id);
         $vol->edit_date('now');
@@ -1375,7 +1375,7 @@ sub batch_volume_transfer {
         unless( $override && ($oargs->{all} || grep { $_ eq 'COPY_REMOTE_CIRC_LIB' } @{$oargs->{events}}) ) {
             for my $v (@all) {
 
-                $logger->debug("merge: searching for copies with remote circ_lib for volume ".$v->id);
+                $logger->debug(sub{return "merge: searching for copies with remote circ_lib for volume ".$v->id });
                 my $args = { 
                     call_number => $v->id, 
                     circ_lib    => { "not in" => [ $o_lib, $v->owning_lib ] },
@@ -1415,8 +1415,8 @@ sub batch_volume_transfer {
             } else {
                 # this volume exists on the destination record/owning_lib and must
                 # be used as the destination for merging
-                $logger->debug("merge: volume already exists at destination record: ".
-                    $existing_vol->id.' : '.$existing_vol->label) if $existing_vol;
+                $logger->debug(sub{return "merge: volume already exists at destination record: ".
+                    $existing_vol->id.' : '.$existing_vol->label }) if $existing_vol;
             }
         } 
 
@@ -1435,7 +1435,7 @@ sub batch_volume_transfer {
             $vol->editor($e->requestor->id);
             $vol->edit_date('now');
     
-            $logger->info("merge: updating volume ".$vol->id);
+            $logger->info(sub{return "merge: updating volume ".$vol->id });
             $e->update_asset_call_number($vol) or return $e->event;
 
         } else {
@@ -1455,7 +1455,7 @@ sub batch_volume_transfer {
         # update circ lib on the copies - make this a method flag?
         for my $copy (@$copies) {
             next if $copy->circ_lib == $o_lib;
-            $logger->info("merge: transfer moving circ lib on copy ".$copy->id);
+            $logger->info(sub{return "merge: transfer moving circ lib on copy ".$copy->id });
             $copy->circ_lib($o_lib);
             $copy->editor($e->requestor->id);
             $copy->edit_date('now');
index f9f60dc..3fd01b8 100644 (file)
@@ -114,8 +114,8 @@ sub update_copy_stat_entries {
             if (!$add_or_update_only) {
                 if(! grep { $_->id == $map->stat_cat_entry } @$entries ) {
 
-                    $logger->info("copy update found stale ".
-                        "stat cat entry map ".$map->id. " on copy ".$copy->id);
+                    $logger->info(sub{return "copy update found stale ".
+                        "stat cat entry map ".$map->id. " on copy ".$copy->id });
 
                     $editor->delete_asset_stat_cat_entry_copy_map($map)
                         or return $editor->event;
@@ -123,8 +123,8 @@ sub update_copy_stat_entries {
             } else {
                 if( grep { $_->stat_cat == $map->stat_cat and $_->id != $map->stat_cat_entry } @$entries ) {
 
-                    $logger->info("copy update found ".
-                        "stat cat entry map ".$map->id. " needing update on copy ".$copy->id);
+                    $logger->info(sub{return "copy update found ".
+                        "stat cat entry map ".$map->id. " needing update on copy ".$copy->id });
 
                     $editor->delete_asset_stat_cat_entry_copy_map($map)
                         or return $editor->event;
@@ -151,7 +151,7 @@ sub update_copy_stat_entries {
         $editor->create_asset_stat_cat_entry_copy_map($new_map)
             or return $editor->event;
 
-        $logger->info("copy update created new stat cat entry map ".$editor->data);
+        $logger->info(sub{return "copy update created new stat cat entry map ".$editor->data });
     }
 
     return undef;
@@ -183,8 +183,8 @@ sub update_copy_parts {
         for my $map (@$maps) {
             if(! grep { $_->id == $map->part } @$incoming_parts ) {
 
-                $logger->info("copy update found stale ".
-                    "monographic part map ".$map->id. " on copy ".$copy->id);
+                $logger->info(sub{return "copy update found stale ".
+                    "monographic part map ".$map->id. " on copy ".$copy->id });
 
                 $editor->delete_asset_copy_part_map($map)
                     or return $editor->event;
@@ -216,7 +216,7 @@ sub update_copy_parts {
         $editor->create_asset_copy_part_map($new_map)
             or return $editor->event;
 
-        $logger->info("copy update created new monographic part copy map ".$editor->data);
+        $logger->info(sub{return "copy update created new monographic part copy map ".$editor->data });
     }
 
     return undef;
@@ -352,7 +352,7 @@ sub update_copy {
     my $org = (ref $copy->circ_lib) ? $copy->circ_lib->id : $copy->circ_lib;
     return $evt if ( $evt = $class->org_cannot_have_vols($editor, $org) );
 
-    $logger->info("vol-update: updating copy ".$copy->id);
+    $logger->info(sub{return "vol-update: updating copy ".$copy->id });
     my $orig_copy = $editor->retrieve_asset_copy($copy->id);
 
     # Call-number may have changed, find the original
@@ -510,7 +510,7 @@ sub delete_copy {
         }
     }
 
-    $logger->info("vol-update: deleting copy ".$copy->id);
+    $logger->info(sub{return "vol-update: deleting copy ".$copy->id });
     $copy->deleted('t');
 
     $copy->editor($editor->requestor->id);
index c461dba..f1e76a2 100644 (file)
@@ -99,8 +99,8 @@ sub biblio_record_xml_import {
     # Silence warnings when _find_tcn_info() fails
     $tcn ||= '';
     $tcn_source ||= '';
-    $logger->info("user ".$e->requestor->id.
-        " creating new biblio entry with tcn=$tcn and tcn_source $tcn_source");
+    $logger->info(sub{return "user ".$e->requestor->id.
+        " creating new biblio entry with tcn=$tcn and tcn_source $tcn_source" });
 
     my $marc = $U->strip_marc_fields($e, $marcdoc, $strip_grps);
 
@@ -136,7 +136,7 @@ sub biblio_record_xml_import {
         }
     }
 
-    $logger->info("marc create/import created new record ".$record->id);
+    $logger->info(sub{return "marc create/import created new record ".$record->id });
     return $record;
 }
 
index 699af6a..6e6f65c 100644 (file)
@@ -48,7 +48,7 @@ sub merge_records {
     my @recs = keys %r;
 
     my $reqr = $editor->requestor;
-    $logger->activity("merge: user ".$reqr->id." merging bib records: @recs with master = $master");
+    $logger->activity(sub{return "merge: user ".$reqr->id." merging bib records: @recs with master = $master" });
 
     # -----------------------------------------------------------
     # collect all of the volumes, merge any with duplicate 
@@ -60,7 +60,7 @@ sub merge_records {
         push( @volumes, @$vs );
     }
 
-    $logger->info("merge: merge recovered ".scalar(@volumes)." total volumes");
+    $logger->info(sub{return "merge: merge recovered ".scalar(@volumes)." total volumes" });
 
     my @trimmed;
     # de-duplicate any volumes with the same label and owning_lib
@@ -72,31 +72,31 @@ sub merge_records {
         my $o = $v->owning_lib;
 
         if($seen_vols{$v->id}) {
-            $logger->debug("merge: skipping ".$v->id." since it's already been merged");
+            $logger->debug(sub{return "merge: skipping ".$v->id." since it's already been merged" });
             next;
         }
 
         $seen_vols{$v->id} = 1;
 
-        $logger->debug("merge: [".$v->id."] looking for dupes with label $l and owning_lib $o");
+        $logger->debug(sub{return "merge: [".$v->id."] looking for dupes with label $l and owning_lib $o" });
 
         my @dups;
         for my $vv (@volumes) {
             if( $vv->label eq $v->label and $vv->owning_lib == $v->owning_lib ) {
-                $logger->debug("merge: pushing dupe volume ".$vv->id) if @dups;
+                $logger->debug(sub{return "merge: pushing dupe volume ".$vv->id }) if @dups;
                 push( @dups, $vv );
                 $seen_vols{$vv->id} = 1;
             } 
         }
 
         if( @dups == 1 ) {
-            $logger->debug("merge: pushing unique volume into trimmed volume set: ".$v->id);
+            $logger->debug(sub{return "merge: pushing unique volume into trimmed volume set: ".$v->id });
             push( @trimmed, @dups );
 
         } else {
             my($vol, $e) = merge_volumes($editor, \@dups);
             return $e if $e;
-            $logger->debug("merge: pushing vol-merged volume into trimmed volume set: ".$vol->id);
+            $logger->debug(sub{return "merge: pushing vol-merged volume into trimmed volume set: ".$vol->id });
             push(@trimmed, $vol);
         }
     }
@@ -110,8 +110,8 @@ sub merge_records {
     for $vol (@trimmed) {
         if( $vol->record ne $master ) {
 
-            $logger->debug("merge: moving volume ".
-                $vol->id." from record ".$vol->record. " to $master");
+            $logger->debug(sub{return "merge: moving volume ".
+                $vol->id." from record ".$vol->record. " to $master" });
 
             $vol->editor( $editor->requestor->id );
             $vol->edit_date('now');
@@ -169,12 +169,12 @@ sub merge_volumes {
         $master and @$volumes == 1 
         and $master->id == $$volumes[0]->id;
 
-    $logger->debug("merge: fetching copies for volume list of size ".scalar(@$volumes));
+    $logger->debug(sub{return "merge: fetching copies for volume list of size ".scalar(@$volumes) });
 
     # collect all of the copies attached to the selected volumes
     for( @$volumes ) {
         $copies{$_->id} = $editor->search_asset_copy({call_number=>$_->id, deleted=>'f'});
-        $logger->debug("merge: found ".scalar(@{$copies{$_->id}})." copies for volume ".$_->id);
+        $logger->debug(sub{return "merge: found ".scalar(@{$copies{$_->id}})." copies for volume ".$_->id });
     }
     
     my $bigcn;
@@ -205,7 +205,7 @@ sub merge_volumes {
     for my $cn (keys %copies) {
         next if $cn == $bigcn;
         for my $copy (@{$copies{$cn}}) {
-            $logger->debug("merge: setting call_number to $bigcn for copy ".$copy->id);
+            $logger->debug(sub{return "merge: setting call_number to $bigcn for copy ".$copy->id });
             $copy->call_number($bigcn);
             $copy->editor($editor->requestor->id);
             $copy->edit_date('now');
@@ -215,7 +215,7 @@ sub merge_volumes {
 
     for( @$volumes ) {
         next if $_->id == $bigcn;
-        $logger->debug("merge: marking call_number as deleted: ".$_->id);
+        $logger->debug(sub{return "merge: marking call_number as deleted: ".$_->id });
         $_->deleted('t');
         $_->editor($editor->requestor->id);
         $_->edit_date('now');
@@ -224,7 +224,7 @@ sub merge_volumes {
     }
 
     my ($mvol) = grep { $_->id == $bigcn } @$volumes;
-    $logger->debug("merge: returning master volume ".$mvol->id);
+    $logger->debug(sub{return "merge: returning master volume ".$mvol->id });
     return ($mvol);
 }
 
@@ -241,8 +241,8 @@ sub merge_volume_holds {
 
     for my $hold (@$holds) {
 
-        $logger->info("Changing hold ".$hold->id.
-            " target from ".$hold->target." to $master_id in volume merge");
+        $logger->info(sub{return "Changing hold ".$hold->id.
+            " target from ".$hold->target." to $master_id in volume merge" });
 
         $hold->target($master_id);
         unless($e->update_action_hold_request($hold)) {
index 0dfebd3..7ed916e 100644 (file)
@@ -181,8 +181,8 @@ sub checkouts_by_user_slim {
         $apputils->checkses_requestor( $user_session, $user_id, 'VIEW_CIRCULATIONS');
     return $evt if $evt;
 
-    $logger->debug( 'User ' . $requestor->id . 
-        " retrieving checked out items for user " . $target->id );
+    $logger->debug(sub{return 'User ' . $requestor->id . 
+        " retrieving checked out items for user " . $target->id });
 
     # XXX Make the call correct..
     return $apputils->simplereq(
@@ -325,7 +325,7 @@ sub staff_age_to_lost {
     }
 
     if(@event_ids) {
-        $logger->info("staff_age_to_lost: created ".scalar(@event_ids)." events for circ.staff_age_to_lost");
+        $logger->info(sub{return "staff_age_to_lost: created ".scalar(@event_ids)." events for circ.staff_age_to_lost" });
         $conn->respond_complete({'total_progress'=>$progress-1,'created'=>scalar(@event_ids)});
     } elsif($req->complete) {
         $logger->info("staff_age_to_lost: no events to create for circ.staff_age_to_lost");
index 73b79a3..ec1dc94 100644 (file)
@@ -115,10 +115,10 @@ sub void_lost {
         }
     );
 
-    $logger->debug("voiding lost item charge of  ".scalar(@$bills));
+    $logger->debug(sub{return "voiding lost item charge of  ".scalar(@$bills) });
     for my $bill (@$bills) {
         if( !$U->is_true($bill->voided) ) {
-            $logger->info("lost item returned - voiding bill ".$bill->id);
+            $logger->info(sub{return "lost item returned - voiding bill ".$bill->id });
             $bill->voided('t');
             $bill->void_time('now');
             $bill->voider($e->requestor->id);
@@ -187,7 +187,7 @@ sub reopen_xact {
     if( $xact->xact_finish ) {
         my ($mbts) = $U->fetch_mbts($xactid, $e);
         if( $mbts->balance_owed != 0 ) {
-            $logger->info("* re-opening xact $xactid, orig xact_finish is ".$xact->xact_finish);
+            $logger->info(sub{return "* re-opening xact $xactid, orig xact_finish is ".$xact->xact_finish });
             $xact->clear_xact_finish;
             $e->update_money_billable_transaction($xact)
                 or return $e->die_event;
@@ -306,7 +306,7 @@ sub extend_grace_period {
                 } while ( $count <= 366 and ( $closed or $due_dt->epoch <= $due + $new_grace_period ) );
                 if ($new_grace_period > $grace_period) {
                     $grace_period = $new_grace_period;
-                    $logger->info( "Grace period for circ extended to $grace_period [" . seconds_to_interval( $grace_period ) . "]" );
+                    $logger->info(sub{return "Grace period for circ extended to $grace_period [" . seconds_to_interval( $grace_period ) . "]" });
                 }
             }
         }
@@ -488,7 +488,7 @@ sub generate_fines {
             # This is a no-op if there is no open transaction.
             $e->xact_rollback if $commit;
 
-            $logger->info(sprintf("Processing $ctype %d...", $c->id));
+            $logger->info(sub{return sprintf("Processing $ctype %d...", $c->id) });
 
             # each (ils) transaction is processed in its own (db) transaction
             $e->xact_begin if $commit;
@@ -504,7 +504,7 @@ sub generate_fines {
     
             if ( $fine_interval == 0 || $c->$recurring_fine_method * 100 == 0 || $c->max_fine * 100 == 0 ) {
                 $conn->respond( "Fine Generator skipping circ due to 0 fine interval, 0 fine rate, or 0 max fine.\n" ) if $conn;
-                $logger->info( "Fine Generator skipping circ " . $c->id . " due to 0 fine interval, 0 fine rate, or 0 max fine." );
+                $logger->info(sub{return "Fine Generator skipping circ " . $c->id . " due to 0 fine interval, 0 fine rate, or 0 max fine." });
                 return;
             }
 
@@ -544,7 +544,7 @@ sub generate_fines {
                 $conn->respond( "Last billing time: ".$fine->billing_ts." (clensed format: ".clean_ISO8601( $fine->billing_ts ).")") if $conn;
                 $last_fine = $parser->parse_datetime( clean_ISO8601( $fine->billing_ts ) )->epoch;
             } else {
-                $logger->info( "Potential first billing for circ ".$c->id );
+                $logger->info(sub{return "Potential first billing for circ ".$c->id });
                 $last_fine = $due;
 
                 $grace_period = extend_grace_period($class, $c->$circ_lib_method,$c->$due_date_method,$grace_period,undef,$hoo{$c->$circ_lib_method});
@@ -559,7 +559,7 @@ sub generate_fines {
                  && $now < $due + $grace_period             # and some date math says were are within the grace period
             ) {
                 $conn->respond( "Still inside grace period of: ". seconds_to_interval( $grace_period )."\n" ) if $conn;
-                $logger->info( "Circ ".$c->id." is still inside grace period of: $grace_period [". seconds_to_interval( $grace_period ).']' );
+                $logger->info(sub{return "Circ ".$c->id." is still inside grace period of: $grace_period [". seconds_to_interval( $grace_period ).']' });
                 return;
             }
 
index 7a2958a..e7e34c6 100644 (file)
@@ -301,7 +301,7 @@ sub run_method {
         # Log the events
         my @e = @{$circulator->events};
         push( @ee, $_->{textcode} ) for @e;
-        $logger->info("circulator: bailing out with events: " . (join ", ", @ee));
+        $logger->info(sub{return "circulator: bailing out with events: " . (join ", ", @ee) });
 
         $circulator->editor->rollback;
 
@@ -599,7 +599,7 @@ sub push_events {
         $e->{payload} = $self->copy if 
               ($e->{textcode} eq 'COPY_NOT_AVAILABLE');
 
-        $logger->info("circulator: pushing event ".$e->{textcode});
+        $logger->info(sub{return "circulator: pushing event ".$e->{textcode} });
         push( @{$self->events}, $e ) unless
             grep { $_->{textcode} eq $e->{textcode} } @{$self->events};
     }
@@ -677,8 +677,8 @@ sub collect_user_copy_alerts {
             {flesh => 1, flesh_fields => { aca => [ qw/ alert_type / ] }}
         ]);
         if (ref $alerts eq "ARRAY") {
-            $logger->info("circulator: found " . scalar(@$alerts) . " alerts for copy " .
-                $self->copy->id);
+            $logger->info(sub{return "circulator: found " . scalar(@$alerts) . " alerts for copy " .
+                $self->copy->id });
             $self->user_copy_alerts($alerts);
         }
     }
@@ -810,8 +810,8 @@ sub generate_system_copy_alerts {
     }
 
     if (@final_types) {
-        $logger->info("circulator: found " . scalar(@final_types) . " system alert types for copy" .
-            $self->copy->id);
+        $logger->info(sub{return "circulator: found " . scalar(@final_types) . " system alert types for copy" .
+            $self->copy->id });
     }
 
     my @alerts;
@@ -935,8 +935,8 @@ sub mk_env {
                 }
             );
             if (ref $res eq "ARRAY" and scalar @$res) {
-                $logger->info("circulator: mapped reservation " .
-                    $self->reservation . " to copy " . $res->[0]->{"id"});
+                $logger->info(sub{return "circulator: mapped reservation " .
+                    $self->reservation . " to copy " . $res->[0]->{"id"} });
                 $copy = $e->retrieve_asset_copy([$res->[0]->{"id"}, $MK_ENV_FLESH]);
             }
         }
@@ -1286,7 +1286,7 @@ sub run_patron_permit_scripts {
              ($_->{textcode} eq 'COPY_NOT_AVAILABLE');
     }
 
-    $logger->info("circulator: permit_patron script returned events: @allevents") if @allevents;
+    $logger->info(sub{return "circulator: permit_patron script returned events: @allevents" }) if @allevents;
 
     $self->push_events(@allevents);
 }
@@ -1332,7 +1332,7 @@ sub run_indb_circ_test {
     $self->circ_test_success($U->is_true($results->[0]->{success}));
 
     if(my $mp = $results->[0]->{matchpoint}) {
-        $logger->info("circulator: circ policy test found matchpoint built via rows " . $results->[0]->{buildrows});
+        $logger->info(sub{return "circulator: circ policy test found matchpoint built via rows " . $results->[0]->{buildrows} });
         $self->circ_matrix_matchpoint($self->editor->retrieve_config_circ_matrix_matchpoint($mp));
         $self->circ_matrix_matchpoint->duration_rule($self->editor->retrieve_config_rules_circ_duration($results->[0]->{duration_rule}));
         if(defined($results->[0]->{renewals})) {
@@ -1479,7 +1479,7 @@ sub run_copy_permit_scripts {
     my %hash = map { ($_->{ilsevent} => $_) } @allevents;
     @allevents = values %hash;
 
-    $logger->info("circulator: permit_copy script returned events: @allevents") if @allevents;
+    $logger->info(sub{return "circulator: permit_copy script returned events: @allevents" }) if @allevents;
 
     $self->push_events(@allevents);
 }
@@ -1838,7 +1838,7 @@ sub check_hold_fulfill_blocks {
     return 0 unless @$pens;
 
     for my $pen (@$pens) {
-        $logger->info("circulator: patron has hold FULFILL block " . $pen->{name});
+        $logger->info(sub{return "circulator: patron has hold FULFILL block " . $pen->{name} });
         my $event = OpenILS::Event->new($pen->{name});
         $event->{desc} = $pen->{label};
         $self->push_events($event);
@@ -1872,8 +1872,8 @@ sub handle_checkout_holds {
     if($hold and $hold->usr != $patron->id) {
         # reset the hold since the copy is now checked out
     
-        $logger->info("circulator: un-targeting hold ".$hold->id.
-            " because copy ".$copy->id." is getting checked out");
+        $logger->info(sub{return "circulator: un-targeting hold ".$hold->id.
+            " because copy ".$copy->id." is getting checked out" });
 
         $hold->clear_prev_check_time; 
         $hold->clear_current_copy;
@@ -1895,7 +1895,7 @@ sub handle_checkout_holds {
 
     return if $self->check_hold_fulfill_blocks;
 
-    $logger->debug("circulator: checkout fulfilling hold " . $hold->id);
+    $logger->debug(sub{return "circulator: checkout fulfilling hold " . $hold->id });
 
     # if the hold was never officially captured, capture it.
     $hold->current_copy($copy->id);
@@ -2360,16 +2360,16 @@ sub apply_modified_due_date {
         # is checked out from, not the owning or circ lib of the item
         my $org = $self->circ_lib;
 
-      $logger->info("circulator: circ searching for closed date overlap on lib $org".
-            " with an item due date of ".$circ->due_date );
+      $logger->info(sub{return "circulator: circ searching for closed date overlap on lib $org".
+            " with an item due date of ".$circ->due_date });
 
       my $dateinfo = $U->storagereq(
          'open-ils.storage.actor.org_unit.closed_date.overlap', 
             $org, $circ->due_date );
 
       if($dateinfo) {
-         $logger->info("circulator: $dateinfo : circ due data / close date overlap found : due_date=".
-            $circ->due_date." start=". $dateinfo->{start}.", end=".$dateinfo->{end});
+         $logger->info(sub{return "circulator: $dateinfo : circ due data / close date overlap found : due_date=".
+            $circ->due_date." start=". $dateinfo->{start}.", end=".$dateinfo->{end} });
 
             # XXX make the behavior more dynamic
             # for now, we just push the due date to after the close date
@@ -2428,7 +2428,7 @@ sub make_precat_copy {
     my $copy = $self->copy;
 
    if($copy) {
-        $logger->debug("circulator: Pre-cat copy already exists in checkout: ID=" . $copy->id);
+        $logger->debug(sub{return "circulator: Pre-cat copy already exists in checkout: ID=" . $copy->id });
 
         $copy->editor($self->editor->requestor->id);
         $copy->edit_date('now');
@@ -2440,8 +2440,8 @@ sub make_precat_copy {
         return;
    }
 
-    $logger->info("circulator: Creating a new precataloged ".
-        "copy in checkout with barcode " . $self->copy_barcode);
+    $logger->info(sub{return "circulator: Creating a new precataloged ".
+        "copy in checkout with barcode " . $self->copy_barcode });
 
     $copy = Fieldmapper::asset::copy->new;
     $copy->circ_lib($self->circ_lib);
@@ -2804,7 +2804,7 @@ sub do_checkin {
 
             if( $hold and ( $hold->cancel_time or $hold->fulfillment_time ) ) { # this transited hold was cancelled or filled mid-transit
 
-                $logger->info("circulator: we received a transit on a cancelled or filled hold " . $hold->id);
+                $logger->info(sub{return "circulator: we received a transit on a cancelled or filled hold " . $hold->id });
                 $self->reshelve_copy(1);
                 $self->cancelled_hold_transit(1);
                 $self->notify_hold(0); # don't notify for cancelled holds
@@ -2893,7 +2893,7 @@ sub do_checkin {
                     " is on a remote hold's shelf, sending to $circ_lib");
             }
     
-            $logger->debug("circulator: circlib=$circ_lib, workstation=".$self->circ_lib);
+            $logger->debug(sub{return "circulator: circlib=$circ_lib, workstation=".$self->circ_lib });
 
             my $suppress_transit = 0;
 
@@ -2902,7 +2902,7 @@ sub do_checkin {
                 if($suppress_transit_source && $suppress_transit_source->{value}) {
                     my $suppress_transit_dest = $U->ou_ancestor_setting($circ_lib, 'circ.transit.suppress_non_hold');
                     if($suppress_transit_dest && $suppress_transit_source->{value} eq $suppress_transit_dest->{value}) {
-                        $logger->info("circulator: copy is within transit suppress group: ".$self->copy->barcode." ".$suppress_transit_source->{value});
+                        $logger->info(sub{return "circulator: copy is within transit suppress group: ".$self->copy->barcode." ".$suppress_transit_source->{value} });
                         $suppress_transit = 1;
                     }
                 }
@@ -3091,15 +3091,15 @@ sub checkin_check_holds_shelf {
 
     my $hold = $$holds[0];
 
-    $logger->info("circulator: we found a captured, un-fulfilled hold [".
-        $hold->id. "] for copy ".$self->copy->barcode);
+    $logger->info(sub{return "circulator: we found a captured, un-fulfilled hold [".
+        $hold->id. "] for copy ".$self->copy->barcode });
 
     if( $hold->pickup_lib != $self->circ_lib and not $self->hold_as_transit ) {
         my $suppress_transit_circ = $U->ou_ancestor_setting($self->circ_lib, 'circ.transit.suppress_hold');
         if($suppress_transit_circ && $suppress_transit_circ->{value}) {
             my $suppress_transit_pickup = $U->ou_ancestor_setting($hold->pickup_lib, 'circ.transit.suppress_hold');
             if($suppress_transit_pickup && $suppress_transit_circ->{value} eq $suppress_transit_pickup->{value}) {
-                $logger->info("circulator: hold is within hold transit suppress group .. we're done: ".$self->copy->barcode." ".$suppress_transit_circ->{value});
+                $logger->info(sub{return "circulator: hold is within hold transit suppress group .. we're done: ".$self->copy->barcode." ".$suppress_transit_circ->{value} });
                 $self->fake_hold_dest(1);
                 return 1;
             }
@@ -3107,7 +3107,7 @@ sub checkin_check_holds_shelf {
     }
 
     if( $hold->pickup_lib == $self->circ_lib and not $self->hold_as_transit ) {
-        $logger->info("circulator: hold is for here .. we're done: ".$self->copy->barcode);
+        $logger->info(sub{return "circulator: hold is for here .. we're done: ".$self->copy->barcode });
         return 1;
     }
 
@@ -3159,7 +3159,7 @@ sub checkin_build_copy_transit {
     $transit->source_send_time('now');
     $transit->copy_status( $U->copy_status($copy->status)->id );
 
-    $logger->debug("circulator: setting copy status on transit: ".$transit->copy_status);
+    $logger->debug(sub{return "circulator: setting copy status on transit: ".$transit->copy_status });
 
     if ($self->remote_hold) {
         return $self->bail_on_events($self->editor->event)
@@ -3228,8 +3228,8 @@ sub attempt_checkin_hold_capture {
         $self->editor, $copy, $self->editor->requestor );
 
     if(!$hold) {
-        $logger->debug("circulator: no potential permitted".
-            "holds found for copy ".$copy->barcode);
+        $logger->debug(sub{return "circulator: no potential permitted".
+            "holds found for copy ".$copy->barcode });
         return 0;
     }
 
@@ -3261,7 +3261,7 @@ sub attempt_checkin_hold_capture {
         }
     }
 
-    $logger->info("circulator: found permitted hold ".$hold->id." for copy, capturing...");
+    $logger->info(sub{return "circulator: found permitted hold ".$hold->id." for copy, capturing..." });
 
     $hold->current_copy($copy->id);
     $hold->capture_time('now');
@@ -3350,15 +3350,15 @@ sub attempt_checkin_reservation_capture {
         } elsif ($evt->{"textcode"} eq "SUCCESS") {
             # Re-retrieve copy as reservation capture may have changed
             # its status and whatnot.
-            $logger->info(
+            $logger->info(sub{return
                 "circulator: booking capture win on copy " . $self->copy->id
-            );
+            });
             if (my $new_copy_status = $evt->{"payload"}->{"new_copy_status"}) {
-                $logger->info(
+                $logger->info(sub{return
                     "circulator: changing copy " . $self->copy->id .
                     "'s status from " . $self->copy->status . " to " .
                     $new_copy_status
-                );
+                });
                 $self->copy->status($new_copy_status);
                 $self->update_copy;
             }
@@ -3418,7 +3418,7 @@ sub do_hold_notify {
 
 sub retarget_holds {
     my $self = shift;
-    $logger->info("circulator: retargeting holds @{$self->retarget} after opportunistic capture");
+    $logger->info(sub{return "circulator: retargeting holds @{$self->retarget} after opportunistic capture" });
     my $ses = OpenSRF::AppSession->create('open-ils.hold-targeter');
     $ses->request('open-ils.hold-targeter.target', {hold => $self->retarget});
     # no reason to wait for the return value
@@ -3432,7 +3432,7 @@ sub checkin_build_hold_transit {
    my $hold = $self->hold;
    my $trans = Fieldmapper::action::hold_transit_copy->new;
 
-    $logger->debug("circulator: building hold transit for ".$copy->barcode);
+    $logger->debug(sub{return "circulator: building hold transit for ".$copy->barcode });
 
    $trans->hold($hold->id);
    $trans->source($self->circ_lib);
@@ -3502,7 +3502,7 @@ sub process_received_transit {
 
     my $hold_transit = $self->editor->retrieve_action_hold_transit_copy($transit->id);
 
-    $logger->info("circulator: Recovering original copy status in transit: ".$transit->copy_status);
+    $logger->info(sub{return "circulator: Recovering original copy status in transit: ".$transit->copy_status });
     $copy->status( $transit->copy_status );
     $self->update_copy();
     return if $self->bail_out;
@@ -3814,9 +3814,9 @@ sub checkin_handle_lost_or_longoverdue {
         my $last_chance = 
             OpenILS::Utils::DateTime->interval_to_seconds($max_return) + int($due);
 
-        $logger->info("MAX OD: $max_return LAST ACTIVITY: ".
+        $logger->info(sub{return "MAX OD: $max_return LAST ACTIVITY: ".
             "$last_activity DUEDATE: ".$circ->due_date." TODAY: $today ".
-                "DUE: $due LAST: $last_chance");
+                "DUE: $due LAST: $last_chance" });
 
         $max_return = 0 if $today < $last_chance;
     }
@@ -4024,8 +4024,8 @@ sub log_me {
         $self->barcode;
     $bc ||= "";
     my $usr = ($self->patron) ? $self->patron->id : "";
-    $logger->info("circulator: $msg requestor=".$self->editor->requestor->id.
-        ", recipient=$usr, copy=$bc");
+    $logger->info(sub{return "circulator: $msg requestor=".$self->editor->requestor->id.
+        ", recipient=$usr, copy=$bc" });
 }
 
 
@@ -4254,7 +4254,7 @@ sub checkin_handle_lost_or_lo_now_found_restore_od {
         }
     ]);
 
-    $logger->debug("returning ".scalar(@$ods)." overdue charges pre-$tag");
+    $logger->debug(sub{return "returning ".scalar(@$ods)." overdue charges pre-$tag" });
     # Because actual users get up to all kinds of unexpectedness, we
     # only recreate up to $circ->max_fine in bills.  I know you think
     # it wouldn't happen that bills could get created, voided, and
index e4c9946..b6c9dc4 100644 (file)
@@ -237,9 +237,9 @@ sub dispatch {
         );
     }
 
-    $logger->debug(
+    $logger->debug(sub{return
         "applying payment via processor '" . $argshash->{processor} . "'"
-    );
+    });
 
     # Find B:OP constructor arguments specific to our payment processor.
     my %bop_args = get_bop_args_filler($argshash);
@@ -277,10 +277,10 @@ sub dispatch {
     my $event_name;
 
     if ($transaction->is_success) {
-        $logger->info($argshash->{processor} . " payment succeeded");
+        $logger->info(sub{return $argshash->{processor} . " payment succeeded" });
         $event_name = "SUCCESS";
     } else {
-        $logger->info($argshash->{processor} . " payment failed");
+        $logger->info(sub{return $argshash->{processor} . " payment failed" });
         $event_name = "CREDIT_PROCESSOR_DECLINED_TRANSACTION";
     }
 
index b455960..36ed439 100644 (file)
@@ -104,8 +104,8 @@ sub new {
     $class = ref($class) || $class;
     my $self = bless( {}, $class );
     $self->editor( new_editor( xact => 1, requestor => $args{requestor} ));
-    $logger->debug("circulator: creating new hold-notifier with requestor ".
-        $self->editor->requestor->id);
+    $logger->debug(sub{return "circulator: creating new hold-notifier with requestor ".
+        $self->editor->requestor->id });
     $self->fetch_data($args{hold_id});
     return $self;
 }
@@ -136,7 +136,7 @@ sub send_email_notify {
        return OpenILS::Event->new('PATRON_NO_EMAIL_ADDRESS');
    }
 
-    $logger->info("hold_notify: attempting email notify on hold ".$self->hold->id);
+    $logger->info(sub{return "hold_notify: attempting email notify on hold ".$self->hold->id });
 
     my $sclient = OpenSRF::Utils::SettingsClient->new;
     $self->settings_client($sclient);
@@ -181,8 +181,8 @@ sub send_email {
 
     my $smtp = $self->settings_client->config_value('email_notify', 'smtp_server');
 
-    $logger->info("hold_notify: sending email notice to ".
-        $self->patron->email." with SMTP server $smtp");
+    $logger->info(sub{return "hold_notify: sending email notice to ".
+        $self->patron->email." with SMTP server $smtp" });
 
     my $sender = Email::Send->new({mailer => 'SMTP'});
     $sender->mailer_args([Host => $smtp]);
index 1336e4e..321094c 100644 (file)
@@ -1015,7 +1015,7 @@ sub update_hold_impl {
             return $e->die_event unless $e->allowed('UPDATE_PICKUP_LIB_FROM_TRANSIT', $orig_hold->pickup_lib);
             return $e->die_event unless $e->allowed('UPDATE_PICKUP_LIB_FROM_TRANSIT', $hold->pickup_lib);
 
-            $logger->info("updating pickup lib for hold ".$hold->id." while already in transit");
+            $logger->info(sub{return "updating pickup lib for hold ".$hold->id." while already in transit" });
 
             # update the transit to reflect the new pickup location
             my $transit = $e->search_action_hold_transit_copy(
@@ -1031,7 +1031,7 @@ sub update_hold_impl {
             return $e->die_event unless $e->allowed('UPDATE_PICKUP_LIB_FROM_HOLDS_SHELF', $orig_hold->pickup_lib);
             return $e->die_event unless $e->allowed('UPDATE_PICKUP_LIB_FROM_HOLDS_SHELF', $hold->pickup_lib);
 
-            $logger->info("updating pickup lib for hold ".$hold->id." while on holds shelf");
+            $logger->info(sub{return "updating pickup lib for hold ".$hold->id." while on holds shelf" });
 
             if ($hold->pickup_lib eq $orig_hold->current_shelf_lib) {
                 # This can happen if the pickup lib is changed while the hold is
@@ -1047,11 +1047,11 @@ sub update_hold_impl {
     }
 
     if($U->is_true($hold->frozen)) {
-        $logger->info("clearing current_copy and check_time for frozen hold ".$hold->id);
+        $logger->info(sub{return "clearing current_copy and check_time for frozen hold ".$hold->id });
         $hold->clear_current_copy;
         $hold->clear_prev_check_time;
         # Clear expire_time to prevent frozen holds from expiring.
-        $logger->info("clearing expire_time for frozen hold ".$hold->id);
+        $logger->info(sub{return "clearing expire_time for frozen hold ".$hold->id });
         $hold->clear_expire_time;
     }
 
@@ -1064,7 +1064,7 @@ sub update_hold_impl {
 
     # If the hold is reactivated, reset the expire_time.
     if(!$U->is_true($hold->frozen) && $U->is_true($orig_hold->frozen)) {
-        $logger->info("Reset expire_time on activated hold ".$hold->id);
+        $logger->info(sub{return "Reset expire_time on activated hold ".$hold->id });
         $hold->expire_time(calculate_expire_time($hold->request_lib));
     }
 
@@ -1072,7 +1072,7 @@ sub update_hold_impl {
     $e->commit;
 
     if(!$U->is_true($hold->frozen) && $U->is_true($orig_hold->frozen)) {
-        $logger->info("Running targeter on activated hold ".$hold->id);
+        $logger->info(sub{return "Running targeter on activated hold ".$hold->id });
         $U->simplereq('open-ils.hold-targeter', 
             'open-ils.hold-targeter.target', {hold => $hold->id});
     }
@@ -1163,13 +1163,13 @@ sub update_hold_if_frozen {
     return if $hold->capture_time;
 
     if($U->is_true($hold->frozen)) {
-        $logger->info("clearing current_copy and check_time for frozen hold ".$hold->id);
+        $logger->info(sub{return "clearing current_copy and check_time for frozen hold ".$hold->id });
         $hold->clear_current_copy;
         $hold->clear_prev_check_time;
 
     } else {
         if($U->is_true($orig_hold->frozen)) {
-            $logger->info("Running targeter on activated hold ".$hold->id);
+            $logger->info(sub{return "Running targeter on activated hold ".$hold->id });
             $U->simplereq('open-ils.hold-targeter', 
                 'open-ils.hold-targeter.target', {hold => $hold->id});
         }
@@ -1786,7 +1786,7 @@ sub print_hold_pull_list_stream {
         }, {"substream" => 1}
     ) or return $e->die_event;
 
-    $logger->info("about to stream back " . scalar(@$holds_ids) . " holds");
+    $logger->info(sub{return "about to stream back " . scalar(@$holds_ids) . " holds" });
 
     my @chunk;
     for my $hid (@$holds_ids) {
@@ -1839,7 +1839,7 @@ sub fetch_hold_notify {
     $evt = $U->check_perms($requestor->id, $patron->home_ou, 'VIEW_HOLD_NOTIFICATION');
     return $evt if $evt;
 
-    $logger->info("User ".$requestor->id." fetching hold notifications for hold $holdid");
+    $logger->info(sub{return "User ".$requestor->id." fetching hold notifications for hold $holdid" });
     return $U->cstorereq(
         'open-ils.cstore.direct.action.hold_notification.search.atomic', {hold => $holdid} );
 }
@@ -1960,7 +1960,7 @@ sub _reset_hold {
 
     my $e = new_editor(xact =>1, requestor => $reqr);
 
-    $logger->info("reseting hold ".$hold->id);
+    $logger->info(sub{return "reseting hold ".$hold->id });
 
     my $hid = $hold->id;
 
@@ -2258,7 +2258,7 @@ sub print_expired_holds_stream {
         return $hold_ids[0];
     }
 
-    $logger->info("about to stream back up to " . scalar(@hold_ids) . " expired holds");
+    $logger->info(sub{return "about to stream back up to " . scalar(@hold_ids) . " expired holds" });
 
     while (@hold_ids) {
         my @hid_chunk = splice @hold_ids, 0, $params->{"chunk_size"};
@@ -2571,8 +2571,8 @@ sub create_ranged_org_filter {
     %org_filter = (circ_lib => []);
     push(@{$org_filter{circ_lib}}, $_->id) for @$org_list;
 
-    $logger->info("hold org filter at depth $depth and selection_ou ".
-        "$selection_ou created list of @{$org_filter{circ_lib}}");
+    $logger->info(sub{return "hold org filter at depth $depth and selection_ou ".
+        "$selection_ou created list of @{$org_filter{circ_lib}}" });
 
     return %org_filter;
 }
@@ -2612,7 +2612,7 @@ sub _check_title_hold_is_possible {
         }
     );
 
-    $logger->info("title possible found ".scalar(@$copies)." potential copies");
+    $logger->info(sub{return "title possible found ".scalar(@$copies)." potential copies" });
     return (
         0, 0, [
             new OpenILS::Event(
@@ -2634,7 +2634,7 @@ sub _check_title_hold_is_possible {
         $e->search_actor_org_unit_proximity({from_org => $home_org})
         unless $prox_cache{$home_org};
     my $home_prox = $prox_cache{$home_org};
-    $logger->info("prox cache $home_org " . $prox_cache{$home_org});
+    $logger->info(sub{return "prox cache $home_org " . $prox_cache{$home_org} });
 
     my %buckets;
     my %hash = map { ($_->to_org => $_->prox) } @$home_prox;
@@ -2676,14 +2676,14 @@ sub _check_title_hold_is_possible {
     OUTER: for my $key (@keys) {
       my @cps = @{$buckets{$key}};
 
-      $logger->info("looking at " . scalar(@{$buckets{$key}}). " copies in proximity bucket $key");
+      $logger->info(sub{return "looking at " . scalar(@{$buckets{$key}}). " copies in proximity bucket $key" });
 
       for my $copyid (@cps) {
 
          next if $seen{$copyid};
          $seen{$copyid} = 1; # there could be dupes given the merged buckets
          my $copy = $e->retrieve_asset_copy($copyid);
-         $logger->debug("looking at bucket_key=$key, copy $copyid : circ_lib = " . $copy->circ_lib);
+         $logger->debug(sub{return "looking at bucket_key=$key, copy $copyid : circ_lib = " . $copy->circ_lib });
 
          unless($title) { # grab the title if we don't already have it
             my $vol = $e->retrieve_asset_call_number(
@@ -2735,7 +2735,7 @@ sub _check_issuance_hold_is_possible {
         }
     );
 
-    $logger->info("issuance possible found ".scalar(@$copies)." potential copies");
+    $logger->info(sub{return "issuance possible found ".scalar(@$copies)." potential copies" });
 
     my $empty_ok;
     if (!@$copies) {
@@ -2766,7 +2766,7 @@ sub _check_issuance_hold_is_possible {
         $e->search_actor_org_unit_proximity({from_org => $home_org})
         unless $prox_cache{$home_org};
     my $home_prox = $prox_cache{$home_org};
-    $logger->info("prox cache $home_org " . $prox_cache{$home_org});
+    $logger->info(sub{return "prox cache $home_org " . $prox_cache{$home_org} });
 
     my %buckets;
     my %hash = map { ($_->to_org => $_->prox) } @$home_prox;
@@ -2808,14 +2808,14 @@ sub _check_issuance_hold_is_possible {
     OUTER: for my $key (@keys) {
       my @cps = @{$buckets{$key}};
 
-      $logger->info("looking at " . scalar(@{$buckets{$key}}). " copies in proximity bucket $key");
+      $logger->info(sub{return "looking at " . scalar(@{$buckets{$key}}). " copies in proximity bucket $key" });
 
       for my $copyid (@cps) {
 
          next if $seen{$copyid};
          $seen{$copyid} = 1; # there could be dupes given the merged buckets
          my $copy = $e->retrieve_asset_copy($copyid);
-         $logger->debug("looking at bucket_key=$key, copy $copyid : circ_lib = " . $copy->circ_lib);
+         $logger->debug(sub{return "looking at bucket_key=$key, copy $copyid : circ_lib = " . $copy->circ_lib });
 
          unless($title) { # grab the title if we don't already have it
             my $vol = $e->retrieve_asset_call_number(
@@ -2875,7 +2875,7 @@ sub _check_monopart_hold_is_possible {
         }
     );
 
-    $logger->info("monopart possible found ".scalar(@$copies)." potential copies");
+    $logger->info(sub{return "monopart possible found ".scalar(@$copies)." potential copies" });
 
     my $empty_ok;
     if (!@$copies) {
@@ -2906,7 +2906,7 @@ sub _check_monopart_hold_is_possible {
         $e->search_actor_org_unit_proximity({from_org => $home_org})
         unless $prox_cache{$home_org};
     my $home_prox = $prox_cache{$home_org};
-    $logger->info("prox cache $home_org " . $prox_cache{$home_org});
+    $logger->info(sub{return "prox cache $home_org " . $prox_cache{$home_org} });
 
     my %buckets;
     my %hash = map { ($_->to_org => $_->prox) } @$home_prox;
@@ -2948,14 +2948,14 @@ sub _check_monopart_hold_is_possible {
     OUTER: for my $key (@keys) {
       my @cps = @{$buckets{$key}};
 
-      $logger->info("looking at " . scalar(@{$buckets{$key}}). " copies in proximity bucket $key");
+      $logger->info(sub{return "looking at " . scalar(@{$buckets{$key}}). " copies in proximity bucket $key" });
 
       for my $copyid (@cps) {
 
          next if $seen{$copyid};
          $seen{$copyid} = 1; # there could be dupes given the merged buckets
          my $copy = $e->retrieve_asset_copy($copyid);
-         $logger->debug("looking at bucket_key=$key, copy $copyid : circ_lib = " . $copy->circ_lib);
+         $logger->debug(sub{return "looking at bucket_key=$key, copy $copyid : circ_lib = " . $copy->circ_lib });
 
          unless($title) { # grab the title if we don't already have it
             my $vol = $e->retrieve_asset_call_number(
@@ -2988,7 +2988,7 @@ sub _check_volume_hold_is_possible {
     my( $vol, $title, $depth, $request_lib, $patron, $requestor, $pickup_lib, $selection_ou, $oargs ) = @_;
     my %org_filter = create_ranged_org_filter(new_editor(), $selection_ou, $depth);
     my $copies = new_editor->search_asset_copy({call_number => $vol->id, %org_filter});
-    $logger->info("checking possibility of volume hold for volume ".$vol->id);
+    $logger->info(sub{return "checking possibility of volume hold for volume ".$vol->id });
 
     my $filter_copies = [];
     for my $copy (@$copies) {
@@ -3024,7 +3024,7 @@ sub _check_volume_hold_is_possible {
 sub verify_copy_for_hold {
     my( $patron, $requestor, $title, $copy, $pickup_lib, $request_lib, $oargs ) = @_;
     # $oargs should be undef unless we're overriding.
-    $logger->info("checking possibility of copy in hold request for copy ".$copy->id);
+    $logger->info(sub{return "checking possibility of copy in hold request for copy ".$copy->id });
     my $permitted = OpenILS::Utils::PermitHold::permit_copy_hold(
         {
             patron           => $patron,
@@ -3121,8 +3121,8 @@ sub find_nearest_permitted_hold {
 
     my $hold_stall_interval = $U->ou_ancestor_setting_value($user->ws_ou, OILS_SETTING_HOLD_SOFT_STALL);
 
-    $logger->info("circulator: searching for best hold at org ".$user->ws_ou.
-        " and copy $bc with a hold stalling interval of ". ($hold_stall_interval || "(none)"));
+    $logger->info(sub{return "circulator: searching for best hold at org ".$user->ws_ou.
+        " and copy $bc with a hold stalling interval of ". ($hold_stall_interval || "(none)") });
 
     my $fifo = $U->ou_ancestor_setting_value($user->ws_ou, 'circ.holds_fifo');
 
@@ -3196,7 +3196,7 @@ sub find_nearest_permitted_hold {
         return (undef, $evt);
     }
 
-    $logger->info("circulator: best hold ".$best_hold->id." found for copy $bc");
+    $logger->info(sub{return "circulator: best hold ".$best_hold->id." found for copy $bc" });
 
     # indicate a permitted hold was found
     return $best_hold if $check_only;
@@ -3213,8 +3213,8 @@ sub find_nearest_permitted_hold {
     # re-target any other holds that already target this copy
     for my $old_hold (@$old_holds) {
         next if $old_hold->id eq $best_hold->id; # don't re-target the hold we want
-        $logger->info("circulator: clearing current_copy and prev_check_time on hold ".
-            $old_hold->id." after a better hold [".$best_hold->id."] was found");
+        $logger->info(sub{return "circulator: clearing current_copy and prev_check_time on hold ".
+            $old_hold->id." after a better hold [".$best_hold->id."] was found" });
         $old_hold->clear_current_copy;
         $old_hold->clear_prev_check_time;
         $editor->update_action_hold_request($old_hold)
@@ -4108,7 +4108,7 @@ sub change_hold_title {
 
     for my $hold (@$holds) {
         $e->allowed('UPDATE_HOLD', $hold->usr->home_ou) or return $e->die_event;
-        $logger->info("Changing hold " . $hold->id . " target from " . $hold->target . " to $new_bib_id in title hold target change");
+        $logger->info(sub{return "Changing hold " . $hold->id . " target from " . $hold->target . " to $new_bib_id in title hold target change" });
         $hold->target( $new_bib_id );
         $e->update_action_hold_request($hold) or return $e->die_event;
     }
@@ -4145,7 +4145,7 @@ sub change_hold_title_for_specific_holds {
 
     for my $hold (@$holds) {
         $e->allowed('UPDATE_HOLD', $hold->usr->home_ou) or return $e->die_event;
-        $logger->info("Changing hold " . $hold->id . " target from " . $hold->target . " to $new_bib_id in title hold target change");
+        $logger->info(sub{return "Changing hold " . $hold->id . " target from " . $hold->target . " to $new_bib_id in title hold target change" });
         $hold->target( $new_bib_id );
         $e->update_action_hold_request($hold) or return $e->die_event;
     }
index 6b84a78..24b7f2c 100644 (file)
@@ -423,12 +423,12 @@ sub make_payments {
             );
 
             if ($U->event_code($response)) { # non-success (success is 0)
-                $logger->info(
+                $logger->info(sub{return
                     "Credit card payment for user $user_id failed: " .
                     $response->{textcode} . " " .
                     ($response->{payload}->{error_message} ||
                         $response->{payload}{message})
-                );
+                });
                 return $response;
             } else {
                 # We need to save this for later in case there's a failure on
@@ -761,7 +761,7 @@ sub create_grocery_bill {
     return $evt if $evt;
 
 
-    $logger->activity("Creating grocery bill " . Dumper($transaction) );
+    $logger->activity(sub{return "Creating grocery bill " . Dumper($transaction) });
 
     $transaction->clear_id;
     my $session = $apputils->start_db_session;
@@ -1251,7 +1251,7 @@ sub retrieve_credit_payable_balance {
     }
 
     my @credit_orgs = map { $hash{$_} ? ($_) : () } keys %hash;
-    $logger->debug("credit: relevant orgs that allow credit payments => @credit_orgs");
+    $logger->debug(sub{return "credit: relevant orgs that allow credit payments => @credit_orgs" });
 
     my $xact_summaries =
       OpenILS::Application::AppUtils->simplereq('open-ils.actor',
index 2d6262a..0de99c4 100644 (file)
@@ -532,7 +532,7 @@ sub create_stat_map {
     $evt = $apputils->check_perms( $user_obj->id, $perm_org, $perm );
     return $evt if $evt;
 
-    $logger->debug( $user_obj->id . " creating new stat cat map" );
+    $logger->debug(sub{return $user_obj->id . " creating new stat cat map" });
 
     $map->clear_id();
 
index f627b99..88e6735 100644 (file)
@@ -70,9 +70,9 @@ sub transit_receive {
     return $evt if $evt;
 
     if( $transit->dest != $requestor->ws_ou ) {
-        $logger->activity("Fowarding transit on copy which is destined ".
+        $logger->activity(sub{return "Fowarding transit on copy which is destined ".
             "for a different location. copy=$copyid,current ".
-            "location=".$requestor->ws_ou.",destination location=".$transit->dest);
+            "location=".$requestor->ws_ou.",destination location=".$transit->dest });
 
         return OpenILS::Event->new('ROUTE_ITEM', org => $transit->dest );
     }
@@ -90,7 +90,7 @@ sub transit_receive {
         $ishold = 1;
     }
 
-    $logger->info("Recovering original copy status in transit: ".$transit->copy_status);
+    $logger->info(sub{return "Recovering original copy status in transit: ".$transit->copy_status });
     $copy->status( $transit->copy_status );
     return $evt if ( $evt = 
         $U->update_copy( copy => $copy, editor => $requestor->id, session => $session ));
@@ -136,8 +136,8 @@ sub copy_transit_create {
     my $transit     = Fieldmapper::action::transit_copy->new;
     $U->set_audit_info($session, $authtoken, $requestor->id, $requestor->wsid);
 
-    $logger->activity("User ". $requestor->id ." creating a ".
-        " new copy transit for copy ".$copy->id." to org $dest");
+    $logger->activity(sub{return "User ". $requestor->id ." creating a ".
+        " new copy transit for copy ".$copy->id." to org $dest" });
 
     $transit->source($source);
     $transit->dest($dest);
index b451cbd..aa23350 100644 (file)
@@ -278,7 +278,7 @@ sub process_users_of_interest_results {
 
         unless($total) {
             $total = time - $starttime;
-            $logger->info("collections: request (@params) took $total seconds");
+            $logger->info(sub{return "collections: request (@params) took $total seconds" });
         }
 
         my $u = $e->retrieve_actor_user(
@@ -462,8 +462,8 @@ sub put_into_collections {
 
     return OpenILS::Event->new('MONEY_COLLECTIONS_TRACKER_EXISTS') if @$existing;
 
-    $logger->info("collect: user ".$e->requestor->id.
-        " putting user $user_id into collections for $location");
+    $logger->info(sub{return "collect: user ".$e->requestor->id.
+        " putting user $user_id into collections for $location" });
 
     my $tracker = Fieldmapper::money::collections_tracker->new;
 
@@ -958,7 +958,7 @@ sub flesh_payment {
     my $e = shift;
     my $p = shift;
     my $type = $p->payment_type;
-    $logger->debug("collect: fleshing workstation on payment $type : ".$p->id);
+    $logger->debug(sub{return "collect: fleshing workstation on payment $type : ".$p->id });
     my $meth = "retrieve_money_$type";
     $p = $e->$meth($p->id) or return (undef, $e->event);
     try {
@@ -998,7 +998,7 @@ sub fetch_circ_xacts {
     $U->walk_org_tree( $org,
         sub {
             my $n = shift;
-            $logger->debug("collect: searching for open circs at " . $n->shortname);
+            $logger->debug(sub{return "collect: searching for open circs at " . $n->shortname });
             push( @circs,
                 @{
                     $e->search_action_circulation(
@@ -1047,7 +1047,7 @@ sub fetch_grocery_xacts {
     $U->walk_org_tree( $org,
         sub {
             my $n = shift;
-            $logger->debug("collect: searching for open grocery xacts at " . $n->shortname);
+            $logger->debug(sub{return "collect: searching for open grocery xacts at " . $n->shortname });
             push( @xacts,
                 @{
                     $e->search_money_grocery(
@@ -1094,7 +1094,7 @@ sub fetch_reservation_xacts {
     $U->walk_org_tree( $org,
         sub {
             my $n = shift;
-            $logger->debug("collect: searching for open grocery xacts at " . $n->shortname);
+            $logger->debug(sub{return "collect: searching for open grocery xacts at " . $n->shortname });
             push( @xacts,
                 @{
                     $e->search_booking_reservation(
index bc968b5..82f84c0 100644 (file)
@@ -371,7 +371,7 @@ sub request {
         $logger->error('EbookAPI: no HTTP response received');
         return;
     } else {
-        $logger->info("EbookAPI: response received from server: " . $res->status_line);
+        $logger->info(sub{return "EbookAPI: response received from server: " . $res->status_line });
         return {
             is_success => $res->is_success,
             status     => $res->status_line,
index 602a7dc..be0e67b 100644 (file)
@@ -163,7 +163,7 @@ sub do_availability_lookup {
     };
     my $res = $self->request($req, $session_id);
     if (defined ($res)) {
-        $logger->info("EbookAPI: received availability response for ISBN $isbn: " . Dumper $res);
+        $logger->info(sub{return "EbookAPI: received availability response for ISBN $isbn: " . Dumper $res });
         return $res->{content}->{availability};
     } else {
         $logger->error("EbookAPI: could not retrieve OneClickdigital availability for ISBN $isbn");
@@ -272,7 +272,7 @@ sub get_patron_checkouts {
 
     my $checkouts = [];
     if (defined ($res)) {
-        $logger->info("EbookAPI: received response for OneClickdigital checkouts: " . Dumper $res);
+        $logger->info(sub{return "EbookAPI: received response for OneClickdigital checkouts: " . Dumper $res });
         foreach my $checkout (@{$res->{content}}) {
             push @$checkouts, {
                 xact_id => $checkout->{transactionId},
@@ -283,7 +283,7 @@ sub get_patron_checkouts {
                 author => $checkout->{authors}
             };
         };
-        $logger->info("EbookAPI: retrieved " . scalar(@$checkouts) . " OneClickdigital checkouts for patron $patron_id");
+        $logger->info(sub{return "EbookAPI: retrieved " . scalar(@$checkouts) . " OneClickdigital checkouts for patron $patron_id" });
         $self->{checkouts} = $checkouts;
         return $self->{checkouts};
     } else {
@@ -306,7 +306,7 @@ sub get_patron_holds {
 
     my $holds = [];
     if (defined ($res)) {
-        $logger->info("EbookAPI: received response for OneClickdigital holds: " . Dumper $res);
+        $logger->info(sub{return "EbookAPI: received response for OneClickdigital holds: " . Dumper $res });
         foreach my $hold (@{$res->{content}}) {
             push @$holds, {
                 xact_id => $hold->{transactionId},
@@ -320,7 +320,7 @@ sub get_patron_holds {
                 is_ready => 0
             };
         };
-        $logger->info("EbookAPI: retrieved " . scalar(@$holds) . " OneClickdigital holds for patron $patron_id");
+        $logger->info(sub{return "EbookAPI: retrieved " . scalar(@$holds) . " OneClickdigital holds for patron $patron_id" });
         $self->{holds} = $holds;
         return $self->{holds};
     } else {
index 6eca31e..91cdf04 100644 (file)
@@ -164,7 +164,7 @@ sub handle_http_request {
     # Send the request.
     my $res = $self->request($req, $self->{session_id});
 
-    $logger->info("EbookAPI: raw OverDrive HTTP response: " . Dumper $res);
+    $logger->info(sub{return "EbookAPI: raw OverDrive HTTP response: " . Dumper $res });
 
     # A "401 Unauthorized" response means we need to re-auth our client or patron.
     if (defined ($res) && $res->{status} =~ /^401/) {
index 159ecd7..130eccb 100644 (file)
@@ -374,7 +374,7 @@ __PACKAGE__->register_method(
 );
 sub biblio_id_to_copy { 
     my( $self, $client, $ids ) = @_;
-    $logger->info("Fetching copies @$ids");
+    $logger->info(sub{return "Fetching copies @$ids" });
     return $U->cstorereq(
         "open-ils.cstore.direct.asset.copy.search.atomic", { id => $ids } );
 }
@@ -486,7 +486,7 @@ __PACKAGE__->register_method(
 
 sub fleshed_copy_retrieve_batch { 
     my( $self, $client, $ids ) = @_;
-    $logger->info("Fetching fleshed copies @$ids");
+    $logger->info(sub{return "Fetching fleshed copies @$ids" });
     return $U->cstorereq(
         "open-ils.cstore.direct.asset.copy.search.atomic",
         { id => $ids },
@@ -1234,12 +1234,12 @@ sub staged_search {
             $summary = shift(@$results) if $results;
 
             unless($summary) {
-                $logger->info("search timed out: duration=$search_duration: params=".
-                    OpenSRF::Utils::JSON->perl2JSON($search_hash));
+                $logger->info(sub{return "search timed out: duration=$search_duration: params=".
+                    OpenSRF::Utils::JSON->perl2JSON($search_hash) });
                 return {count => 0};
             }
 
-            $logger->info("staged search: DB call took $search_duration seconds and returned ".scalar(@$results)." rows, including summary");
+            $logger->info(sub{return "staged search: DB call took $search_duration seconds and returned ".scalar(@$results)." rows, including summary" });
 
             # Create backwards-compatible result structures
             if($IAmMetabib) {
@@ -1301,7 +1301,7 @@ sub staged_search {
         }
     );
 
-    $logger->info("Completed canonicalized search is: $$global_summary{canonicalized_query}");
+    $logger->info(sub{return "Completed canonicalized search is: $$global_summary{canonicalized_query}" });
 
     return cache_facets($facet_key, $new_ids, $IAmMetabib, $ignore_facet_classes) if $docache;
 }
@@ -1495,10 +1495,10 @@ sub cache_staged_search_page {
         results => $results
     };
 
-    $logger->info("staged search: cached with key=$key, superpage=$page, estimated=".
+    $logger->info(sub{return "staged search: cached with key=$key, superpage=$page, estimated=".
         ($summary->{estimated_hit_count} || "none") .
         ", visible=" . ($summary->{visible} || "none")
-    );
+    });
 
     $cache->put_cache($key, $data, $cache_timeout);
 }
@@ -1529,7 +1529,7 @@ sub search_cache {
         push( @result, $d );
     }
 
-    $logger->debug("search_cache found ".scalar(@result)." items for count=$count, start=$start, end=$end");
+    $logger->debug(sub{return "search_cache found ".scalar(@result)." items for count=$count, start=$start, end=$end" });
 
     return \@result;
 }
@@ -1538,8 +1538,8 @@ sub search_cache {
 sub put_cache {
     my( $key, $count, $data ) = @_;
     return undef unless $cache;
-    $logger->debug("search_cache putting ".
-        scalar(@$data)." items at key $key with timeout $cache_timeout");
+    $logger->debug(sub{return "search_cache putting ".
+        scalar(@$data)." items at key $key with timeout $cache_timeout" });
     $cache->put_cache($key, [ $count, $data ], $cache_timeout);
 }
 
@@ -1613,8 +1613,8 @@ sub biblio_mrid_to_modsbatch {
 
         $mvr->title( $mods->title );
         $mvr->author($mods->author);
-        $logger->debug("mods_slim updating title and ".
-            "author in mvr with ".$mods->title." : ".$mods->author);
+        $logger->debug(sub{return "mods_slim updating title and ".
+            "author in mvr with ".$mods->title." : ".$mods->author });
     }
 
     return $mvr;
@@ -1708,7 +1708,7 @@ sub biblio_mrid_make_modsbatch {
     }
 
     for(@$subrecs) {
-        $logger->debug("adding record ".$_->id." to mods batch for metarecord=$mrid");
+        $logger->debug(sub{return "adding record ".$_->id." to mods batch for metarecord=$mrid" });
         $u->push_mods_batch( $_->marc ) if $_->marc;
     }
 
@@ -2211,7 +2211,7 @@ __PACKAGE__->register_method(
 # XXX: see biblio_search_isbn() for note concerning 'limit'
 sub biblio_search_isbn_batch { 
     my( $self, $client, $isbn_list ) = @_;
-    $logger->debug("Searching ISBNs @$isbn_list");
+    $logger->debug(sub{return "Searching ISBNs @$isbn_list" });
     my @recs = (); my %rec_set = ();
     my $method = $self->method_lookup('open-ils.search.biblio.multiclass.query');
     foreach my $isbn ( @$isbn_list ) {
index cff8c6f..e8b888e 100644 (file)
@@ -257,7 +257,7 @@ sub do_class_search {
         $tmp_args{username} = $$args{username}[$i];
         $tmp_args{password} = $$args{password}[$i];
 
-        $logger->debug("z3950: service: $tmp_args{service}, async: $tmp_args{async}");
+        $logger->debug(sub{return "z3950: service: $tmp_args{service}, async: $tmp_args{async}" });
 
         if ($tmp_args{service} eq 'native-evergreen-catalog') { 
             my $method = $self->method_lookup('open-ils.search.biblio.zstyle.staff'); 
@@ -279,7 +279,7 @@ sub do_class_search {
                 push @results, $res->{result}; 
                 push @connections, $res->{connection}; 
 
-                $logger->debug("z3950: Result object: $results[$i], Connection object: $connections[$i]");
+                $logger->debug(sub{return "z3950: Result object: $results[$i], Connection object: $connections[$i]" });
             } 
         }
 
@@ -407,7 +407,7 @@ sub do_search {
     return OpenILS::Event->new('Z3950_SEARCH_FAILED', 
         debug => $connection->errcode." => ".$connection->errmsg." : query = $query") unless $results;
 
-    $logger->info("z3950: search [$query] took ".(time - $start)." seconds");
+    $logger->info(sub{return "z3950: search [$query] took ".(time - $start)." seconds" });
 
     return {result => $results, connection => $connection} if ($async);
 
index d41c688..96866c7 100644 (file)
@@ -320,7 +320,7 @@ sub fleshed_item_alter {
     }
 
     if( $evt ) {
-        $logger->info("fleshed item-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
+        $logger->info(sub{return "fleshed item-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt) });
         $editor->rollback;
         return $evt;
     }
@@ -342,7 +342,7 @@ sub fleshed_item_alter {
                 $logger->info("fleshed item-alter deleting issuance $id as it has no items left");
                 $evt = _delete_siss( $editor, $override, $issuance);
                 if( $evt ) {
-                    $logger->info("fleshed item-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
+                    $logger->info(sub{return "fleshed item-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt) });
                     $editor->rollback;
                     return $evt;
                 }
@@ -351,13 +351,13 @@ sub fleshed_item_alter {
     }
     $logger->debug("item-alter: done updating item batch");
     $editor->commit;
-    $logger->info("fleshed item-alter successfully updated ".scalar(@$items)." items");
+    $logger->info(sub{return "fleshed item-alter successfully updated ".scalar(@$items)." items" });
     return 1;
 }
 
 sub _delete_sitem {
     my ($editor, $override, $item) = @_;
-    $logger->info("item-alter: delete item ".OpenSRF::Utils::JSON->perl2JSON($item));
+    $logger->info(sub{return "item-alter: delete item ".OpenSRF::Utils::JSON->perl2JSON($item) });
     return $editor->event unless $editor->delete_serial_item($item);
     return 0;
 }
@@ -368,7 +368,7 @@ sub _create_sitem {
     $item->creator($editor->requestor->id);
     $item->create_date('now');
 
-    $logger->info("item-alter: new item ".OpenSRF::Utils::JSON->perl2JSON($item));
+    $logger->info(sub{return "item-alter: new item ".OpenSRF::Utils::JSON->perl2JSON($item) });
     return $editor->event unless $editor->create_serial_item($item);
     return 0;
 }
@@ -376,11 +376,11 @@ sub _create_sitem {
 sub _update_sitem {
     my ($editor, $override, $item) = @_;
 
-    $logger->info("item-alter: retrieving item ".$item->id);
+    $logger->info(sub{return "item-alter: retrieving item ".$item->id });
     my $orig_item = $editor->retrieve_serial_item($item->id);
 
-    $logger->info("item-alter: original item ".OpenSRF::Utils::JSON->perl2JSON($orig_item));
-    $logger->info("item-alter: updated item ".OpenSRF::Utils::JSON->perl2JSON($item));
+    $logger->info(sub{return "item-alter: original item ".OpenSRF::Utils::JSON->perl2JSON($orig_item) });
+    $logger->info(sub{return "item-alter: updated item ".OpenSRF::Utils::JSON->perl2JSON($item) });
     return $editor->event unless $editor->update_serial_item($item);
     return 0;
 }
@@ -394,7 +394,7 @@ __PACKAGE__->register_method(
 sub fleshed_serial_item_retrieve_batch {
     my( $self, $client, $ids ) = @_;
 # FIXME: permissions?
-    $logger->info("Fetching fleshed serial items @$ids");
+    $logger->info(sub{return "Fetching fleshed serial items @$ids" });
     return $U->cstorereq(
         "open-ils.cstore.direct.serial.item.search.atomic",
         { id => $ids },
@@ -484,20 +484,20 @@ sub fleshed_issuance_alter {
     }
 
     if ( $evt ) {
-        $logger->info("fleshed issuance-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
+        $logger->info(sub{return "fleshed issuance-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt) });
         $editor->rollback;
         return $evt;
     }
 
     $logger->debug("issuance-alter: done updating issuance batch");
     $editor->commit;
-    $logger->info("fleshed issuance-alter successfully updated ".scalar(@$issuances)." issuances");
+    $logger->info(sub{return "fleshed issuance-alter successfully updated ".scalar(@$issuances)." issuances" });
     return 1;
 }
 
 sub _delete_siss {
     my ($editor, $override, $issuance) = @_;
-    $logger->info("issuance-alter: delete issuance ".OpenSRF::Utils::JSON->perl2JSON($issuance));
+    $logger->info(sub{return "issuance-alter: delete issuance ".OpenSRF::Utils::JSON->perl2JSON($issuance) });
     return $editor->event unless $editor->delete_serial_issuance($issuance);
     return 0;
 }
@@ -508,7 +508,7 @@ sub _create_siss {
     $issuance->creator($editor->requestor->id);
     $issuance->create_date('now');
 
-    $logger->info("issuance-alter: new issuance ".OpenSRF::Utils::JSON->perl2JSON($issuance));
+    $logger->info(sub{return "issuance-alter: new issuance ".OpenSRF::Utils::JSON->perl2JSON($issuance) });
     return $editor->event unless $editor->create_serial_issuance($issuance);
     return 0;
 }
@@ -516,11 +516,11 @@ sub _create_siss {
 sub _update_siss {
     my ($editor, $override, $issuance) = @_;
 
-    $logger->info("issuance-alter: retrieving issuance ".$issuance->id);
+    $logger->info(sub{return "issuance-alter: retrieving issuance ".$issuance->id });
     my $orig_issuance = $editor->retrieve_serial_issuance($issuance->id);
 
-    $logger->info("issuance-alter: original issuance ".OpenSRF::Utils::JSON->perl2JSON($orig_issuance));
-    $logger->info("issuance-alter: updated issuance ".OpenSRF::Utils::JSON->perl2JSON($issuance));
+    $logger->info(sub{return "issuance-alter: original issuance ".OpenSRF::Utils::JSON->perl2JSON($orig_issuance) });
+    $logger->info(sub{return "issuance-alter: updated issuance ".OpenSRF::Utils::JSON->perl2JSON($issuance) });
     return $editor->event unless $editor->update_serial_issuance($issuance);
     return 0;
 }
@@ -534,7 +534,7 @@ __PACKAGE__->register_method(
 sub fleshed_serial_issuance_retrieve_batch {
     my( $self, $client, $ids ) = @_;
 # FIXME: permissions?
-    $logger->info("Fetching fleshed serial issuances @$ids");
+    $logger->info(sub{return "Fetching fleshed serial issuances @$ids" });
     return $U->cstorereq(
         "open-ils.cstore.direct.serial.issuance.search.atomic",
         { id => $ids },
@@ -807,13 +807,13 @@ sub fleshed_sunit_alter {
     }
 
     if( $evt ) {
-        $logger->info("fleshed sunit-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
+        $logger->info(sub{return "fleshed sunit-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt) });
         $editor->rollback;
         return $evt;
     }
     $logger->debug("sunit-alter: done updating sunit batch");
     $editor->commit;
-    $logger->info("fleshed sunit-alter successfully updated ".scalar(@$sunits)." Units");
+    $logger->info(sub{return "fleshed sunit-alter successfully updated ".scalar(@$sunits)." Units" });
     return 1;
 }
 
@@ -851,7 +851,7 @@ sub _create_sunit {
         );
     }
 
-    $logger->info("sunit-alter: new Unit ".OpenSRF::Utils::JSON->perl2JSON($sunit));
+    $logger->info(sub{return "sunit-alter: new Unit ".OpenSRF::Utils::JSON->perl2JSON($sunit) });
     return $editor->die_event unless $editor->create_serial_unit($sunit);
     return 0;
 }
@@ -859,11 +859,11 @@ sub _create_sunit {
 sub _update_sunit {
     my ($editor, $override, $sunit) = @_;
 
-    $logger->info("sunit-alter: retrieving sunit ".$sunit->id);
+    $logger->info(sub{return "sunit-alter: retrieving sunit ".$sunit->id });
     my $orig_sunit = $editor->retrieve_serial_unit($sunit->id);
 
-    $logger->info("sunit-alter: original sunit ".OpenSRF::Utils::JSON->perl2JSON($orig_sunit));
-    $logger->info("sunit-alter: updated sunit ".OpenSRF::Utils::JSON->perl2JSON($sunit));
+    $logger->info(sub{return "sunit-alter: original sunit ".OpenSRF::Utils::JSON->perl2JSON($orig_sunit) });
+    $logger->info(sub{return "sunit-alter: updated sunit ".OpenSRF::Utils::JSON->perl2JSON($sunit) });
     return $editor->event unless $editor->update_serial_unit($sunit);
     return 0;
 }
@@ -974,7 +974,7 @@ __PACKAGE__->register_method(
 
 sub make_prediction_values {
     my ($self, $conn, $authtoken, $args, $ssub, $sdists, $editor) = @_;
-    $logger->debug('make_prediction_values with args: ' . OpenSRF::Utils::JSON->perl2JSON($args));
+    $logger->debug(sub{return 'make_prediction_values with args: ' . OpenSRF::Utils::JSON->perl2JSON($args) });
 
     my $ssub_id = $args->{ssub_id};
 
@@ -1057,17 +1057,17 @@ sub make_prediction_values {
                 );
             }
         }
-        $logger->debug('make_prediction_values reviving holdings: ' . OpenSRF::Utils::JSON->perl2JSON($predict_from_siss));
+        $logger->debug(sub{return 'make_prediction_values reviving holdings: ' . OpenSRF::Utils::JSON->perl2JSON($predict_from_siss) });
         $options->{predict_from} = _revive_holding($predict_from_siss->holding_code, $caption_field, 1); # fresh MFHD Record, so we simply default to 1 for seqno
         if ($fake_chron_needed) {
             $options->{faked_chron_date} = DateTime::Format::ISO8601->new->parse_datetime(clean_ISO8601($predict_from_siss->date_published));
         }
-        $logger->debug('make_prediction_values predicting with options: ' . OpenSRF::Utils::JSON->perl2JSON($options));
+        $logger->debug(sub{return 'make_prediction_values predicting with options: ' . OpenSRF::Utils::JSON->perl2JSON($options) });
         push( @predictions, _generate_issuance_values($mfhd, $options) );
         $link_id++;
     }
 
-    $logger->debug('make_prediction_values predictions: ' . OpenSRF::Utils::JSON->perl2JSON(\@predictions));
+    $logger->debug(sub{return 'make_prediction_values predictions: ' . OpenSRF::Utils::JSON->perl2JSON(\@predictions) });
     return \@predictions;
 }
 
@@ -1137,7 +1137,7 @@ sub _generate_issuance_values {
     my $predict_from = $options->{predict_from};   # MFHD::Holding to predict from
     my $faked_chron_date = $options->{faked_chron_date};   # serial does not have a (complete) chronology caption, so add one (temporarily) based on this date 
 
-    $logger->debug('_generate_issuance_values predict_from: ' . OpenSRF::Utils::JSON->perl2JSON($predict_from));
+    $logger->debug(sub{return '_generate_issuance_values predict_from: ' . OpenSRF::Utils::JSON->perl2JSON($predict_from) });
 
 # Only needed for 'real' MFHD records, not our temp records
 #    my $link_id = $caption->link_id;
@@ -1177,7 +1177,7 @@ sub _generate_issuance_values {
         # to recreate rather than try to update
         $faked_caption = new MFHD::Caption($faked_caption);
         $predict_from = new MFHD::Holding($predict_from->seqno, new MARC::Field($predict_from->tag, $predict_from->indicator(1), $predict_from->indicator(2), $predict_from->subfields_list), $faked_caption);
-        $logger->debug('_generate_issuance_values fake predict_from: ' . OpenSRF::Utils::JSON->perl2JSON($predict_from));
+        $logger->debug(sub{return '_generate_issuance_values fake predict_from: ' . OpenSRF::Utils::JSON->perl2JSON($predict_from) });
     }
 
     my @predictions = $mfhd->generate_predictions({
@@ -1186,7 +1186,7 @@ sub _generate_issuance_values {
         'num_to_predict' => $num_to_predict,
         'end_date' => $end_date
     });
-    $logger->debug('_generate_issuance_values predictions: ' . OpenSRF::Utils::JSON->perl2JSON(\@predictions));
+    $logger->debug(sub{return '_generate_issuance_values predictions: ' . OpenSRF::Utils::JSON->perl2JSON(\@predictions) });
 
     my $pub_date;
     my @issuance_values;
@@ -1874,7 +1874,7 @@ sub regen_summaries {
 sub _regenerate_summaries {
     my ($e, $opts) = @_;
 
-    $logger->debug('_regenerate_summaries with opts: ' . OpenSRF::Utils::JSON->perl2JSON($opts));
+    $logger->debug(sub{return '_regenerate_summaries with opts: ' . OpenSRF::Utils::JSON->perl2JSON($opts) });
     my @sdist_ids;
     if ($opts->{'ssub_ids'}) {
         foreach my $ssub_id (@{$opts->{'ssub_ids'}}) {
@@ -2839,19 +2839,19 @@ sub fleshed_ssub_alter {
     }
 
     if( $evt ) {
-        $logger->info("fleshed subscription-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
+        $logger->info(sub{return "fleshed subscription-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt) });
         $editor->rollback;
         return $evt;
     }
     $logger->debug("subscription-alter: done updating subscription batch");
     $editor->commit;
-    $logger->info("fleshed subscription-alter successfully updated ".scalar(@$ssubs)." subscriptions");
+    $logger->info(sub{return "fleshed subscription-alter successfully updated ".scalar(@$ssubs)." subscriptions" });
     return 1;
 }
 
 sub _delete_ssub {
     my ($editor, $override, $ssub) = @_;
-    $logger->info("subscription-alter: delete subscription ".OpenSRF::Utils::JSON->perl2JSON($ssub));
+    $logger->info(sub{return "subscription-alter: delete subscription ".OpenSRF::Utils::JSON->perl2JSON($ssub) });
     my $sdists = $editor->search_serial_distribution(
             { subscription => $ssub->id }, { limit => 1 } ); #TODO: 'deleted' support?
     my $cps = $editor->search_serial_caption_and_pattern(
@@ -2868,7 +2868,7 @@ sub _delete_ssub {
 sub _create_ssub {
     my ($editor, $ssub) = @_;
 
-    $logger->info("subscription-alter: new subscription ".OpenSRF::Utils::JSON->perl2JSON($ssub));
+    $logger->info(sub{return "subscription-alter: new subscription ".OpenSRF::Utils::JSON->perl2JSON($ssub) });
     return $editor->event unless $editor->create_serial_subscription($ssub);
     return 0;
 }
@@ -2876,11 +2876,11 @@ sub _create_ssub {
 sub _update_ssub {
     my ($editor, $override, $ssub) = @_;
 
-    $logger->info("subscription-alter: retrieving subscription ".$ssub->id);
+    $logger->info(sub{return "subscription-alter: retrieving subscription ".$ssub->id });
     my $orig_ssub = $editor->retrieve_serial_subscription($ssub->id);
 
-    $logger->info("subscription-alter: original subscription ".OpenSRF::Utils::JSON->perl2JSON($orig_ssub));
-    $logger->info("subscription-alter: updated subscription ".OpenSRF::Utils::JSON->perl2JSON($ssub));
+    $logger->info(sub{return "subscription-alter: original subscription ".OpenSRF::Utils::JSON->perl2JSON($orig_ssub) });
+    $logger->info(sub{return "subscription-alter: updated subscription ".OpenSRF::Utils::JSON->perl2JSON($ssub) });
     return $editor->event unless $editor->update_serial_subscription($ssub);
     return 0;
 }
@@ -2894,7 +2894,7 @@ __PACKAGE__->register_method(
 sub fleshed_serial_subscription_retrieve_batch {
     my( $self, $client, $ids ) = @_;
 # FIXME: permissions?
-    $logger->info("Fetching fleshed subscriptions @$ids");
+    $logger->info(sub{return "Fetching fleshed subscriptions @$ids" });
     return $U->cstorereq(
         "open-ils.cstore.direct.serial.subscription.search.atomic",
         { id => $ids },
@@ -3061,19 +3061,19 @@ sub fleshed_sdist_alter {
     }
 
     if( $evt ) {
-        $logger->info("fleshed distribution-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
+        $logger->info(sub{return "fleshed distribution-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt) });
         $editor->rollback;
         return $evt;
     }
     $logger->debug("distribution-alter: done updating distribution batch");
     $editor->commit;
-    $logger->info("fleshed distribution-alter successfully updated ".scalar(@$sdists)." distributions");
+    $logger->info(sub{return "fleshed distribution-alter successfully updated ".scalar(@$sdists)." distributions" });
     return 1;
 }
 
 sub _delete_sdist {
     my ($editor, $override, $sdist) = @_;
-    $logger->info("distribution-alter: delete distribution ".OpenSRF::Utils::JSON->perl2JSON($sdist));
+    $logger->info(sub{return "distribution-alter: delete distribution ".OpenSRF::Utils::JSON->perl2JSON($sdist) });
     return $editor->event unless $editor->delete_serial_distribution($sdist);
     return 0;
 }
@@ -3081,7 +3081,7 @@ sub _delete_sdist {
 sub _create_sdist {
     my ($editor, $sdist) = @_;
 
-    $logger->info("distribution-alter: new distribution ".OpenSRF::Utils::JSON->perl2JSON($sdist));
+    $logger->info(sub{return "distribution-alter: new distribution ".OpenSRF::Utils::JSON->perl2JSON($sdist) });
     return $editor->event unless $editor->create_serial_distribution($sdist);
 
     # create summaries too
@@ -3109,11 +3109,11 @@ sub _create_sdist {
 sub _update_sdist {
     my ($editor, $override, $sdist) = @_;
 
-    $logger->info("distribution-alter: retrieving distribution ".$sdist->id);
+    $logger->info(sub{return "distribution-alter: retrieving distribution ".$sdist->id });
     my $orig_sdist = $editor->retrieve_serial_distribution($sdist->id);
 
-    $logger->info("distribution-alter: original distribution ".OpenSRF::Utils::JSON->perl2JSON($orig_sdist));
-    $logger->info("distribution-alter: updated distribution ".OpenSRF::Utils::JSON->perl2JSON($sdist));
+    $logger->info(sub{return "distribution-alter: original distribution ".OpenSRF::Utils::JSON->perl2JSON($orig_sdist) });
+    $logger->info(sub{return "distribution-alter: updated distribution ".OpenSRF::Utils::JSON->perl2JSON($sdist) });
     return $editor->event unless $editor->update_serial_distribution($sdist);
     return 0;
 }
@@ -3127,7 +3127,7 @@ __PACKAGE__->register_method(
 sub fleshed_serial_distribution_retrieve_batch {
     my( $self, $client, $ids ) = @_;
 # FIXME: permissions?
-    $logger->info("Fetching fleshed distributions @$ids");
+    $logger->info(sub{return "Fetching fleshed distributions @$ids" });
     return $U->cstorereq(
         "open-ils.cstore.direct.serial.distribution.search.atomic",
         { id => $ids },
@@ -3267,19 +3267,19 @@ sub scap_alter {
     }
 
     if( $evt ) {
-        $logger->info("caption_and_pattern-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
+        $logger->info(sub{return "caption_and_pattern-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt) });
         $editor->rollback;
         return $evt;
     }
     $logger->debug("caption_and_pattern-alter: done updating caption_and_pattern batch");
     $editor->commit;
-    $logger->info("caption_and_pattern-alter successfully updated ".scalar(@$scaps)." caption_and_patterns");
+    $logger->info(sub{return "caption_and_pattern-alter successfully updated ".scalar(@$scaps)." caption_and_patterns" });
     return 1;
 }
 
 sub _delete_scap {
     my ($editor, $override, $scap) = @_;
-    $logger->info("caption_and_pattern-alter: delete caption_and_pattern ".OpenSRF::Utils::JSON->perl2JSON($scap));
+    $logger->info(sub{return "caption_and_pattern-alter: delete caption_and_pattern ".OpenSRF::Utils::JSON->perl2JSON($scap) });
     my $sisses = $editor->search_serial_issuance(
             { caption_and_pattern => $scap->id }, { limit => 1 } ); #TODO: 'deleted' support?
     return OpenILS::Event->new(
@@ -3292,7 +3292,7 @@ sub _delete_scap {
 sub _create_scap {
     my ($editor, $scap) = @_;
 
-    $logger->info("caption_and_pattern-alter: new caption_and_pattern ".OpenSRF::Utils::JSON->perl2JSON($scap));
+    $logger->info(sub{return "caption_and_pattern-alter: new caption_and_pattern ".OpenSRF::Utils::JSON->perl2JSON($scap) });
     return $editor->event unless $editor->create_serial_caption_and_pattern($scap);
     return 0;
 }
@@ -3300,11 +3300,11 @@ sub _create_scap {
 sub _update_scap {
     my ($editor, $override, $scap) = @_;
 
-    $logger->info("caption_and_pattern-alter: retrieving caption_and_pattern ".$scap->id);
+    $logger->info(sub{return "caption_and_pattern-alter: retrieving caption_and_pattern ".$scap->id });
     my $orig_scap = $editor->retrieve_serial_caption_and_pattern($scap->id);
 
-    $logger->info("caption_and_pattern-alter: original caption_and_pattern ".OpenSRF::Utils::JSON->perl2JSON($orig_scap));
-    $logger->info("caption_and_pattern-alter: updated caption_and_pattern ".OpenSRF::Utils::JSON->perl2JSON($scap));
+    $logger->info(sub{return "caption_and_pattern-alter: original caption_and_pattern ".OpenSRF::Utils::JSON->perl2JSON($orig_scap) });
+    $logger->info(sub{return "caption_and_pattern-alter: updated caption_and_pattern ".OpenSRF::Utils::JSON->perl2JSON($scap) });
     return $editor->event unless $editor->update_serial_caption_and_pattern($scap);
     return 0;
 }
@@ -3317,7 +3317,7 @@ __PACKAGE__->register_method(
 
 sub serial_caption_and_pattern_retrieve_batch {
     my( $self, $client, $ids ) = @_;
-    $logger->info("Fetching caption_and_patterns @$ids");
+    $logger->info(sub{return "Fetching caption_and_patterns @$ids" });
     return $U->cstorereq(
         "open-ils.cstore.direct.serial.caption_and_pattern.search.atomic",
         { id => $ids }
@@ -3380,19 +3380,19 @@ sub sstr_alter {
     }
 
     if( $evt ) {
-        $logger->info("stream-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
+        $logger->info(sub{return "stream-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt) });
         $editor->rollback;
         return $evt;
     }
     $logger->debug("stream-alter: done updating stream batch");
     $editor->commit;
-    $logger->info("stream-alter successfully updated ".scalar(@$sstrs)." streams");
+    $logger->info(sub{return "stream-alter successfully updated ".scalar(@$sstrs)." streams" });
     return 1;
 }
 
 sub _delete_sstr {
     my ($editor, $override, $sstr) = @_;
-    $logger->info("stream-alter: delete stream ".OpenSRF::Utils::JSON->perl2JSON($sstr));
+    $logger->info(sub{return "stream-alter: delete stream ".OpenSRF::Utils::JSON->perl2JSON($sstr) });
     my $sitems = $editor->search_serial_item(
             { stream => $sstr->id }, { limit => 1 } ); #TODO: 'deleted' support?
     return OpenILS::Event->new(
@@ -3405,7 +3405,7 @@ sub _delete_sstr {
 sub _create_sstr {
     my ($editor, $sstr) = @_;
 
-    $logger->info("stream-alter: new stream ".OpenSRF::Utils::JSON->perl2JSON($sstr));
+    $logger->info(sub{return "stream-alter: new stream ".OpenSRF::Utils::JSON->perl2JSON($sstr) });
     return $editor->event unless $editor->create_serial_stream($sstr);
     return 0;
 }
@@ -3413,11 +3413,11 @@ sub _create_sstr {
 sub _update_sstr {
     my ($editor, $override, $sstr) = @_;
 
-    $logger->info("stream-alter: retrieving stream ".$sstr->id);
+    $logger->info(sub{return "stream-alter: retrieving stream ".$sstr->id });
     my $orig_sstr = $editor->retrieve_serial_stream($sstr->id);
 
-    $logger->info("stream-alter: original stream ".OpenSRF::Utils::JSON->perl2JSON($orig_sstr));
-    $logger->info("stream-alter: updated stream ".OpenSRF::Utils::JSON->perl2JSON($sstr));
+    $logger->info(sub{return "stream-alter: original stream ".OpenSRF::Utils::JSON->perl2JSON($orig_sstr) });
+    $logger->info(sub{return "stream-alter: updated stream ".OpenSRF::Utils::JSON->perl2JSON($sstr) });
     return $editor->event unless $editor->update_serial_stream($sstr);
     return 0;
 }
@@ -3430,7 +3430,7 @@ __PACKAGE__->register_method(
 
 sub serial_stream_retrieve_batch {
     my( $self, $client, $ids ) = @_;
-    $logger->info("Fetching streams @$ids");
+    $logger->info(sub{return "Fetching streams @$ids" });
     return $U->cstorereq(
         "open-ils.cstore.direct.serial.stream.search.atomic",
         { id => $ids }
@@ -3551,25 +3551,25 @@ sub sum_alter {
     }
 
     if( $evt ) {
-        $logger->info("${type}_summary-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
+        $logger->info(sub{return "${type}_summary-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt) });
         $editor->rollback;
         return $evt;
     }
     $logger->debug("${type}_summary-alter: done updating ${type}_summary batch");
     $editor->commit;
-    $logger->info("${type}_summary-alter successfully updated ".scalar(@$sums)." ${type}_summaries");
+    $logger->info(sub{return "${type}_summary-alter successfully updated ".scalar(@$sums)." ${type}_summaries" });
     return 1;
 }
 
 sub _update_sum {
     my ($editor, $override, $sum, $type) = @_;
 
-    $logger->info("${type}_summary-alter: retrieving ${type}_summary ".$sum->id);
+    $logger->info(sub{return "${type}_summary-alter: retrieving ${type}_summary ".$sum->id });
     my $retrieve_method = "retrieve_serial_${type}_summary";
     my $orig_sum = $editor->$retrieve_method($sum->id);
 
-    $logger->info("${type}_summary-alter: original ${type}_summary ".OpenSRF::Utils::JSON->perl2JSON($orig_sum));
-    $logger->info("${type}_summary-alter: updated ${type}_summary ".OpenSRF::Utils::JSON->perl2JSON($sum));
+    $logger->info(sub{return "${type}_summary-alter: original ${type}_summary ".OpenSRF::Utils::JSON->perl2JSON($orig_sum) });
+    $logger->info(sub{return "${type}_summary-alter: updated ${type}_summary ".OpenSRF::Utils::JSON->perl2JSON($sum) });
     my $update_method = "update_serial_${type}_summary";
     return $editor->event unless $editor->$update_method($sum);
     return 0;
@@ -3599,7 +3599,7 @@ sub serial_summary_retrieve_batch {
     $self->api_name =~ /serial\.(\w*)_summary/;
     my $type = $1;
 
-    $logger->info("Fetching ${type}_summaries @$ids");
+    $logger->info(sub{return "Fetching ${type}_summaries @$ids" });
     return $U->cstorereq(
         "open-ils.cstore.direct.serial.".$type."_summary.search.atomic",
         { id => $ids }
@@ -3976,11 +3976,11 @@ sub replace_routing_list_users {
                 {"stream" => $user->stream}
             ) or return $e->die_event;
 
-            $logger->info(
+            $logger->info(sub{return
                 "Deleting srlu: [" .
                 join(", ", map { $_->id; } @$to_delete) .
                 "]"
-            );
+            });
 
             foreach (@$to_delete) {
                 $e->delete_serial_routing_list_user($_) or
@@ -4351,7 +4351,7 @@ sub fetch_pattern_templates {
     my $patterns = $e->json_query({
         from => [ 'serial.pattern_templates_visible_to' => $org_unit ]
     });
-$logger->info(Dumper($patterns)); use Data::Dumper;
+$logger->info(sub{return Dumper($patterns) }); use Data::Dumper;
 
     $client->respond($e->retrieve_serial_pattern_template($_->{id}))
         foreach (@$patterns);
index 3b55c62..efff2f0 100644 (file)
@@ -145,7 +145,7 @@ sub begin_xaction {
 
     local $WRITE = 1;
 
-    $log->debug(" XACT --> 'BEGIN'ing transaction for session ".$client->session->session_id,DEBUG);
+    $log->debug(sub{return " XACT --> 'BEGIN'ing transaction for session ".$client->session->session_id },DEBUG);
     try {
         OpenILS::Application::Storage::CDBI->db_Main->begin_work;
         $client->session->session_data( xact_id => $client->session->session_id );
@@ -231,7 +231,7 @@ sub rollback_xaction {
 
     local $WRITE = 1;
 
-    $log->debug(" XACT --> 'ROLLBACK'ing transaction for session ".$client->session->session_id,DEBUG);
+    $log->debug(sub{return " XACT --> 'ROLLBACK'ing transaction for session ".$client->session->session_id },DEBUG);
     $client->session->session_data( xact_id => '' );
     return OpenILS::Application::Storage::CDBI->db_Main->rollback;
 }
index d164251..40b239e 100644 (file)
@@ -163,7 +163,7 @@ sub retrieve {
     try {
         $rec = $self->SUPER::retrieve("$arg");
     } catch Error with {
-        $log->debug("Could not retrieve $self with $arg! -- ".shift(), DEBUG);
+        $log->debug(sub{return "Could not retrieve $self with $arg! -- ".shift() }, DEBUG);
         return undef;
     };
     return $rec;
@@ -192,8 +192,8 @@ sub merge {
 
     delete $$arg{$_} for (keys %$search);
 
-    $log->debug("CDBI->merge: \$search is $search (".ref($search)." : ".join(',',map{"$_ => $$search{$_}"}keys(%$search)).")",DEBUG);
-    $log->debug("CDBI->merge: \$arg is $arg (".ref($arg)." : ".join(',',map{"$_ => $$arg{$_}"}keys(%$arg)).")",DEBUG);
+    $log->debug(sub{return "CDBI->merge: \$search is $search (".ref($search)." : ".join(',',map{"$_ => $$search{$_}"}keys(%$search)).")" },DEBUG);
+    $log->debug(sub{return "CDBI->merge: \$arg is $arg (".ref($arg)." : ".join(',',map{"$_ => $$arg{$_}"}keys(%$arg)).")" },DEBUG);
 
     my @objs = ($self);
     @objs = $self->search_where($search) unless (ref $self);
@@ -215,8 +215,8 @@ sub remote_update {
 
     delete $$arg{$_} for (keys %$search);
 
-    $log->debug("CDBI->remote_update: \$search is $search (".ref($search)." : ".join(',',map{"$_ => $$search{$_}"}keys(%$search)).")",DEBUG);
-    $log->debug("CDBI->remote_update: \$arg is $arg (".ref($arg)." : ".join(',',map{"$_ => $$arg{$_}"}keys(%$arg)).")",DEBUG);
+    $log->debug(sub{return "CDBI->remote_update: \$search is $search (".ref($search)." : ".join(',',map{"$_ => $$search{$_}"}keys(%$search)).")" },DEBUG);
+    $log->debug(sub{return "CDBI->remote_update: \$arg is $arg (".ref($arg)." : ".join(',',map{"$_ => $$arg{$_}"}keys(%$arg)).")" },DEBUG);
 
 #   my @objs = $self->search_where($search);
 #   throw OpenSRF::EX::WARN ("No objects found for remote_update.  Perhaps you meant to use merge?")
@@ -247,7 +247,7 @@ sub create {
     my $self = shift;
     my $arg = shift;
 
-    $log->debug("CDBI->create: \$arg is $arg (".ref($arg)." : ".OpenSRF::Utils::JSON->perl2JSON($arg).")",DEBUG);
+    $log->debug(sub{return "CDBI->create: \$arg is $arg (".ref($arg)." : ".OpenSRF::Utils::JSON->perl2JSON($arg).")" },DEBUG);
 
     if (ref($arg) && UNIVERSAL::isa($arg => 'Fieldmapper')) {
         return $self->create_from_fieldmapper($arg,@_);
@@ -261,7 +261,7 @@ sub create_from_fieldmapper {
     my $fm = shift;
     my @params = @_;
 
-    $log->debug("Creating node of type ".ref($fm), DEBUG);
+    $log->debug(sub{return "Creating node of type ".ref($fm) }, DEBUG);
 
     my $class = ref($obj) || $obj;
     my ($primary) = $class->columns('Primary');
@@ -297,7 +297,7 @@ sub delete {
 
     $self = $self->retrieve($arg) if (!ref($self));
     unless (defined $self) {
-        $log->debug("ARG! Couldn't retrieve record ".$arg->id, DEBUG);
+        $log->debug(sub{return "ARG! Couldn't retrieve record ".$arg->id }, DEBUG);
         throw OpenSRF::EX::WARN ("ARG! Couldn't retrieve record ");
     }
 
@@ -410,7 +410,7 @@ sub modify_from_fieldmapper {
 
     for my $field ( keys %hash ) {
         $obj->$field( $hash{$field} ) if ($obj->$field ne $hash{$field});
-        $log->debug("Setting field $field on $obj to $hash{$field}",INTERNAL);
+        $log->debug(sub{return "Setting field $field on $obj to $hash{$field}" },INTERNAL);
     }
 
     if ($class->find_column( 'last_xact_id' ) and $obj->is_changed) {
index 3a64595..25457b2 100644 (file)
@@ -64,7 +64,7 @@
         $$master{host} ||= 'localhost';
         $$master{db} ||= 'openils';
 
-        $log->debug("Attempting to connect to $$master{db} at $$master{host}", INFO);
+        $log->debug(sub{return "Attempting to connect to $$master{db} at $$master{host}" }, INFO);
 
         try {
             $master_db = DBI->connect(
@@ -96,7 +96,7 @@
             throw $e;
         };
 
-        $log->debug("Connected to MASTER db $$master{db} at $$master{host}", INFO);
+        $log->debug(sub{return "Connected to MASTER db $$master{db} at $$master{host}" }, INFO);
         
         $master_db->do("SET NAMES '$$master{client_encoding}';") if ($$master{client_encoding});
 
 
             $slave_dbs[-1]->do("SET NAMES '$$db{client_encoding}';") if ($$master{client_encoding});
 
-            $log->debug("Connected to MASTER db '$$master{db} at $$master{host}", INFO);
+            $log->debug(sub{return "Connected to MASTER db '$$master{db} at $$master{host}" }, INFO);
         }
 
         $log->debug("All is well on the western front", INTERNAL);
index 9410851..f25dc4d 100644 (file)
@@ -431,7 +431,7 @@ sub initialize_search_field_virtual_map {
     __PACKAGE__->add_search_field_virtual_map( $_->real, $_->virtual, $_->weight )
         for (@$cmfvm_list);
 
-    $logger->debug('Virtual field map: ' . Dumper($self->search_field_virtual_map));
+    $logger->debug(sub{return 'Virtual field map: ' . Dumper($self->search_field_virtual_map) });
     return $self->search_field_virtual_map;
 }
 
@@ -831,7 +831,7 @@ sub toSQL {
     $self->QueryParser->superpage_size($filters{superpage_size}) if ($filters{superpage_size});
     $self->QueryParser->core_limit($filters{core_limit}) if ($filters{core_limit});
 
-    $logger->debug("Query plan:\n".Dumper($self));
+    $logger->debug(sub{return "Query plan:\n".Dumper($self) });
 
     my $flat_plan = $self->flatten;
 
@@ -1281,7 +1281,7 @@ sub flatten {
                                 my $natural_field = $self->QueryParser->search_field_id_map->{by_id}{$$real_field{real}};
 
                                 $node->add_vfield($$real_field{real});
-                                $logger->debug("Looking up virtual field for real field $$real_field{real}");
+                                $logger->debug(sub{return "Looking up virtual field for real field $$real_field{real}" });
                                 my $vtable = $node->table(
                                     $self->QueryParser
                                         ->search_field_class_by_id($$real_field{real})
index 157aa7c..e06e5f8 100644 (file)
 
         my $col_list = join ',', @cols;
 
-        $log->debug('Starting COPY import for '.$self->{cdbi}->table." ($col_list)", DEBUG);
+        $log->debug(sub{return 'Starting COPY import for '.$self->{cdbi}->table." ($col_list)" }, DEBUG);
         $self->{cdbi}->sql_copy_start($self->{cdbi}->table, $col_list)->execute;
 
         return 1;
 
         $dbh->pg_endcopy || $log->debug("Could not end COPY with pg_endcopy", WARN);
 
-        $log->debug('COPY import for '.$self->{cdbi}->table." ($col_list) complete", DEBUG);
+        $log->debug(sub{return 'COPY import for '.$self->{cdbi}->table." ($col_list) complete" }, DEBUG);
 
         return 1;
     }
index 8c9e62e..789affc 100644 (file)
@@ -72,8 +72,8 @@ sub decompose {
     my @words = $term =~ /\b((?<!!)\w+)\b/go;
     my @nots = $term =~ /\b(?<=!)(\w+)\b/go;
 
-    $log->debug("Stripped words are[".join(', ',@words)."]",DEBUG);
-    $log->debug("Stripped nots are[".join(', ',@nots)."]",DEBUG);
+    $log->debug(sub{return "Stripped words are[".join(', ',@words)."]" },DEBUG);
+    $log->debug(sub{return "Stripped nots are[".join(', ',@nots)."]" },DEBUG);
 
     my @parts;
     while ($term =~ s/ ((?<!\\)"{1}) (.*?) ((?<!\\)"){1} //x) {
index dd90f17..33fece8 100644 (file)
@@ -73,11 +73,11 @@ sub cachable_wrapper {
             $ind++;
             my $value_ind = $ind;
             $cache_args{$args[$key_ind]} = $args[$value_ind];
-            $log->debug("Cache limiter value for $args[$key_ind] is $args[$value_ind]", INTERNAL);
+            $log->debug(sub{return "Cache limiter value for $args[$key_ind] is $args[$value_ind]" }, INTERNAL);
             next;
         }
         $key_string .= $args[$ind];
-        $log->debug("Partial cache key value is $args[$ind]", INTERNAL);
+        $log->debug(sub{return "Partial cache key value is $args[$ind]" }, INTERNAL);
         push @real_args, $args[$ind];
     }
 
@@ -92,8 +92,8 @@ sub cachable_wrapper {
 
     my $cached_res = OpenSRF::Utils::Cache->new->get_cache( $cache_key );
     if (defined $cached_res) {
-        $log->debug("Found ".scalar(@$cached_res)." records in the cache", INFO);
-        $log->debug("Values from cache: ".join(', ', @$cached_res), INTERNAL);
+        $log->debug(sub{return "Found ".scalar(@$cached_res)." records in the cache" }, INFO);
+        $log->debug(sub{return "Values from cache: ".join(', ', @$cached_res) }, INTERNAL);
         my $start = int($cache_args{offset} - ($cache_page * $cache_args{cache_page_size}));
         my $end = int($start + $cache_args{limit} - 1);
         $log->debug("Responding with values from ".$start.' to '.$end,DEBUG);
@@ -107,8 +107,8 @@ sub cachable_wrapper {
 
         $client->respond( $_ ) for ( grep { defined } @res[$cache_args{offset} .. int($cache_args{offset} + $cache_args{limit} - 1)] );
 
-    $log->debug("Saving values from ".int($cache_page * $cache_args{cache_page_size})." to ".
-        int(($cache_page + 1) * $cache_args{cache_page_size}). "to the cache", INTERNAL);
+    $log->debug(sub{return "Saving values from ".int($cache_page * $cache_args{cache_page_size})." to ".
+        int(($cache_page + 1) * $cache_args{cache_page_size}). "to the cache" }, INTERNAL);
     try {
         OpenSRF::Utils::Cache->new->put_cache(
             $cache_key =>
@@ -327,7 +327,7 @@ sub mass_delete {
         $sth->finish;
         $log->debug("MASS Delete succeeded",DEBUG);
     } catch Error with {
-        $log->debug("MASS Delete FAILED : ".shift(),DEBUG);
+        $log->debug(sub{return "MASS Delete FAILED : ".shift() },DEBUG);
         $success = 0;
     };
     return $success;
index 4a49804..f02294e 100644 (file)
@@ -1198,7 +1198,7 @@ sub new_hold_copy_targeter {
                 $self->method_lookup('open-ils.storage.transaction.rollback')->run;
             }
             $self->method_lookup('open-ils.storage.transaction.begin')->run();
-            $log->info("Processing hold ".$hold->id."...\n");
+            $log->info(sub{return "Processing hold ".$hold->id."...\n" });
 
             #first, re-fetch the hold, to make sure it's not captured already
             $hold->remove_from_object_index();
@@ -1346,7 +1346,7 @@ sub new_hold_copy_targeter {
 
             my $pu_lib = ''.$hold->pickup_lib;
             my $prox_list = create_prox_list( $self, $pu_lib, $all_copies, $hold, $hold_copy_map );
-            $log->debug( "\tMapping ".scalar(@$all_copies)." potential copies for hold ".$hold->id);
+            $log->debug(sub{return "\tMapping ".scalar(@$all_copies)." potential copies for hold ".$hold->id });
 
             #$client->status( new OpenSRF::DomainObject::oilsContinueStatus );
 
@@ -1376,12 +1376,12 @@ sub new_hold_copy_targeter {
                     ) || 0;
                 }
 
-#               $logger->info(
+#               $logger->info(sub{return
 #                   "For hold " . $hold->id . " and copy with circ_lib " .
 #                   $c->circ_lib . " we " .
 #                   ($ignore_closing ? "ignore" : "respect")
 #                   . " closed dates"
-#               );
+#               });
 
                 next if (
                     (not $ignore_closing) and
@@ -1403,7 +1403,7 @@ sub new_hold_copy_targeter {
                 #$client->status( new OpenSRF::DomainObject::oilsContinueStatus );
             }
 
-            $log->debug("\t".scalar(@good_copies)." (non-current) copies available for targeting...");
+            $log->debug(sub{return "\t".scalar(@good_copies)." (non-current) copies available for targeting..." });
 
             my $old_best = $hold->current_copy;
             my $old_best_still_valid = 0; # Assume no, but the next line says yes if it is still a potential.
@@ -1446,7 +1446,7 @@ sub new_hold_copy_targeter {
             $client->status( new OpenSRF::DomainObject::oilsContinueStatus );
 
             if (!$best) {
-                $log->debug("\tNothing at the pickup lib, looking elsewhere among ".scalar(@$all_copies)." copies");
+                $log->debug(sub{return "\tNothing at the pickup lib, looking elsewhere among ".scalar(@$all_copies)." copies" });
 
                 $self->{max_loops}{$pu_lib} = $U->ou_ancestor_setting(
                     $pu_lib, 'circ.holds.max_org_unit_target_loops', $editor
@@ -1544,7 +1544,7 @@ sub new_hold_copy_targeter {
             if ($old_best) {
                 # hold wasn't fulfilled, record the fact
             
-                $log->info("\tHold was not (but should have been) fulfilled by ".$old_best->id);
+                $log->info(sub{return "\tHold was not (but should have been) fulfilled by ".$old_best->id });
                 action::unfulfilled_hold_list->create(
                         { hold => ''.$hold->id,
                           current_copy => ''.$old_best->id,
@@ -1554,7 +1554,7 @@ sub new_hold_copy_targeter {
 
             if ($best) {
                 $hold->update( { current_copy => ''.$best->id, prev_check_time => 'now' } );
-                $log->debug("\tUpdating hold [".$hold->id."] with new 'current_copy' [".$best->id."] for hold fulfillment.");
+                $log->debug(sub{return "\tUpdating hold [".$hold->id."] with new 'current_copy' [".$best->id."] for hold fulfillment." });
             } elsif (
                 $old_best_still_valid &&
                 !action::hold_request
@@ -1576,7 +1576,7 @@ sub new_hold_copy_targeter {
                 ))
             ) {     
                 $hold->update( { prev_check_time => 'now', current_copy => ''.$old_best->id } );
-                $log->debug( "\tRetargeting the previously targeted copy [".$old_best->id."]" );
+                $log->debug(sub{return "\tRetargeting the previously targeted copy [".$old_best->id."]" });
             } else {
                 $hold->update( { prev_check_time => 'now' } );
                 $log->info( "\tThere were no targetable copies for the hold" );
@@ -1584,7 +1584,7 @@ sub new_hold_copy_targeter {
             }
 
             $self->method_lookup('open-ils.storage.transaction.commit')->run;
-            $log->info("\tProcessing of hold ".$hold->id." complete.");
+            $log->info(sub{return "\tProcessing of hold ".$hold->id." complete." });
 
             push @successes,
                 { hold => $hold->id,
@@ -1622,7 +1622,7 @@ sub process_recall {
     )->gather(1);
 
     if (!$rv) {
-        $log->info("Recall threshold was not set; bailing out on hold ".$hold->id." processing.");
+        $log->info(sub{return "Recall threshold was not set; bailing out on hold ".$hold->id." processing." });
         return;
     }
     $recall_threshold = $rv->{value};
@@ -1632,7 +1632,7 @@ sub process_recall {
     )->gather(1);
 
     if (!$rv) {
-        $log->info("Recall return interval was not set; bailing out on hold ".$hold->id." processing.");
+        $log->info(sub{return "Recall return interval was not set; bailing out on hold ".$hold->id." processing." });
         return;
     }
     $return_interval = $rv->{value};
@@ -1652,7 +1652,7 @@ sub process_recall {
 
     my @copy_ids = map { $_->id } @$all_copies;
 
-    $log->info("Found " . scalar(@$all_copies) . " eligible checked-out copies for recall");
+    $log->info(sub{return "Found " . scalar(@$all_copies) . " eligible checked-out copies for recall" });
 
     my $return_date = DateTime->now(time_zone => 'local')->add(seconds => interval_to_seconds($return_interval));
 
@@ -1666,7 +1666,7 @@ sub process_recall {
     # If we have a candidate copy, then:
     if (scalar(@$circs)) {
         my $circ = $circs->[0];
-        $log->info("Recalling circ ID : " . $circ->id);
+        $log->info(sub{return "Recalling circ ID : " . $circ->id });
 
         my $old_due_date = DateTime::Format::ISO8601->parse_datetime(clean_ISO8601($circ->due_date));
 
@@ -1707,7 +1707,7 @@ sub process_recall {
         $ses->request('open-ils.trigger.event.autocreate', 'circ.recall.target', $circ->to_fieldmapper(), $circ->circ_lib->id);
     }
 
-    $log->info("Processing of hold ".$hold->id." for recall is now complete.");
+    $log->info(sub{return "Processing of hold ".$hold->id." for recall is now complete." });
 }
 
 sub reservation_targeter {
@@ -1750,7 +1750,7 @@ sub reservation_targeter {
                 $self->method_lookup('open-ils.storage.transaction.rollback')->run;
             }
             $self->method_lookup('open-ils.storage.transaction.begin')->run();
-            $log->info("Processing reservation ".$bresv->id."...\n");
+            $log->info(sub{return "Processing reservation ".$bresv->id."...\n" });
 
             #first, re-fetch the hold, to make sure it's not captured already
             $bresv->remove_from_object_index();
@@ -1862,7 +1862,7 @@ sub reservation_targeter {
                 die "OK\n";
             }
 
-            $log->debug("\t".scalar(@good_resources)." resources available for targeting...");
+            $log->debug(sub{return "\t".scalar(@good_resources)." resources available for targeting..." });
 
             # LFW: note that after the inclusion of hold proximity
             # adjustment, this prox_list is the only prox_list
@@ -1883,7 +1883,7 @@ sub reservation_targeter {
             $client->status( new OpenSRF::DomainObject::oilsContinueStatus );
 
             if (!$best) {
-                $log->debug("\tNothing at the pickup lib, looking elsewhere among ".scalar(@$all_resources)." resources");
+                $log->debug(sub{return "\tNothing at the pickup lib, looking elsewhere among ".scalar(@$all_resources)." resources" });
 
                 $prox_list =
                     map  { $_->[1] }
@@ -1903,11 +1903,11 @@ sub reservation_targeter {
 
             if ($best) {
                 $bresv->update( { current_resource => ''.$best->id } );
-                $log->debug("\tUpdating reservation [".$bresv->id."] with new 'current_resource' [".$best->id."] for reservation fulfillment.");
+                $log->debug(sub{return "\tUpdating reservation [".$bresv->id."] with new 'current_resource' [".$best->id."] for reservation fulfillment." });
             }
 
             $self->method_lookup('open-ils.storage.transaction.commit')->run;
-            $log->info("\tProcessing of bresv ".$bresv->id." complete.");
+            $log->info(sub{return "\tProcessing of bresv ".$bresv->id." complete." });
 
             push @successes,
                 { reservation => $bresv->id,
@@ -2127,7 +2127,7 @@ sub wide_hold_data {
 
     $order_by = [$order_by] if (ref($order_by) !~ /ARRAY/);
     
-    $log->info('Received '. keys(%$restrictions) .' restrictions');
+    $log->info(sub{return 'Received '. keys(%$restrictions) .' restrictions' });
     return 0 unless (ref $restrictions and keys %$restrictions);
 
     # force this to either 'true' or 'false'
index f5e3279..6a66f12 100644 (file)
@@ -61,7 +61,7 @@ sub import_xml_holdings {
             $org_cache{ $f->subfield( $map->{owning_lib} ) } = $ol;
         } otherwise {
             $log->debug('Could not find library with shortname ['.$f->subfield( $map->{owning_lib} ).'] : '. shift(), ERROR);
-            $log->info('Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']');
+            $log->info(sub{return 'Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']' });
         };
         
         try {
@@ -72,7 +72,7 @@ sub import_xml_holdings {
             $org_cache{ $f->subfield( $map->{circulating_lib} ) } = $cl;
         } otherwise {
             $log->debug('Could not find library with shortname ['.$f->subfield( $map->{circulating_lib} ).'] : '. shift(), ERROR);
-            $log->info('Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']');
+            $log->info(sub{return 'Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']' });
         };
 
         next unless ($ol && $cl);
@@ -89,7 +89,7 @@ sub import_xml_holdings {
             );
         } otherwise {
             $log->debug('Could not find or create callnumber ['.$f->subfield( $map->{call_number} )."] on record $record : ". shift(), ERROR);
-            $log->info('Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']');
+            $log->info(sub{return 'Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']' });
         };
 
         next unless ($cn);
index 7a27a7f..5d342a9 100644 (file)
@@ -157,7 +157,7 @@ sub find_authority_marc {
 
     my $recs = authority::full_rec->db_Main->selectcol_arrayref( $select );
     
-    $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+    $log->debug(sub{return "Search yielded ".scalar(@$recs)." results." },DEBUG);
 
     $client->respond($_) for (@$recs);
     return undef;
index 3ca3751..e173421 100644 (file)
@@ -426,11 +426,11 @@ sub biblio_multi_search_full_rec {
                 # MARC control field; mfr.subfield is NULL
                 push @wheres, "( tag = ? AND $fts_where )";
                 push @binds, $$limit{tag};
-                $log->debug("Limiting query using { tag => $$limit{tag} }", DEBUG);
+                $log->debug(sub{return "Limiting query using { tag => $$limit{tag} }" }, DEBUG);
             } else {
                 push @wheres, "( tag = ? AND subfield LIKE ? AND $fts_where )";
                 push @binds, $$limit{tag}, $$limit{subfield};
-                $log->debug("Limiting query using { tag => $$limit{tag}, subfield => $$limit{subfield} }", DEBUG);
+                $log->debug(sub{return "Limiting query using { tag => $$limit{tag}, subfield => $$limit{subfield} }" }, DEBUG);
             }
         }
         my $where = join(' OR ', @wheres);
@@ -651,7 +651,7 @@ sub biblio_multi_search_full_rec {
     $log->debug("Search SQL :: [$select]",DEBUG);
 
     my $recs = metabib::full_rec->db_Main->selectall_arrayref("$select;", {}, @binds);
-    $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+    $log->debug(sub{return "Search yielded ".scalar(@$recs)." results." },DEBUG);
 
     my $max = 0;
     $max = 1 if (!@$recs);
@@ -711,11 +711,11 @@ sub search_full_rec {
             # MARC control field; mfr.subfield is NULL
             push @wheres, "( tag = ? AND $fts_where )";
             push @binds, $$limit{tag};
-            $log->debug("Limiting query using { tag => $$limit{tag} }", DEBUG);
+            $log->debug(sub{return "Limiting query using { tag => $$limit{tag} }" }, DEBUG);
         } else {
             push @wheres, "( tag = ? AND subfield LIKE ? AND $fts_where )";
             push @binds, $$limit{tag}, $$limit{subfield};
-            $log->debug("Limiting query using { tag => $$limit{tag}, subfield => $$limit{subfield} }", DEBUG);
+            $log->debug(sub{return "Limiting query using { tag => $$limit{tag}, subfield => $$limit{subfield} }" }, DEBUG);
         }
     }
     my $where = join(' OR ', @wheres);
@@ -725,7 +725,7 @@ sub search_full_rec {
     $log->debug("Search SQL :: [$select]",DEBUG);
 
     my $recs = metabib::full_rec->db_Main->selectall_arrayref($select, {}, @binds);
-    $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+    $log->debug(sub{return "Search yielded ".scalar(@$recs)." results." },DEBUG);
 
     $client->respond($_) for (@$recs);
     return undef;
@@ -891,7 +891,7 @@ sub search_class_fts {
                 @types, @forms
             );
     
-    $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+    $log->debug(sub{return "Search yielded ".scalar(@$recs)." results." },DEBUG);
 
     $client->respond($_) for (map { [@$_[0,1,3,4]] } @$recs);
     return undef;
@@ -1408,7 +1408,7 @@ sub postfilter_search_class_fts {
             @types, @forms, @aud, @lang, @lit_form,
             ($self->api_name =~ /staff/o ? (@types, @forms, @aud, @lang, @lit_form) : () ) );
     
-    $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+    $log->debug(sub{return "Search yielded ".scalar(@$recs)." results." },DEBUG);
 
     my $max = 0;
     $max = 1 if (!@$recs);
@@ -1901,7 +1901,7 @@ sub postfilter_search_multi_class_fts {
             # ($self->api_name =~ /staff/o ? (@types, @forms, @aud, @lang, @lit_form) : () )
     );
     
-    $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+    $log->debug(sub{return "Search yielded ".scalar(@$recs)." results." },DEBUG);
 
     my $max = 0;
     $max = 1 if (!@$recs);
@@ -2318,7 +2318,7 @@ sub biblio_search_multi_class_fts {
             @bonus_values, @types, @forms, @vformats, @aud, @lang, @lit_form
     );
     
-    $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+    $log->debug(sub{return "Search yielded ".scalar(@$recs)." results." },DEBUG);
 
     my $count = scalar(@$recs);
     for my $rec (@$recs[$offset .. $offset + $limit - 1]) {
@@ -2616,7 +2616,7 @@ sub staged_fts {
 
     $client->respond( $summary_row );
 
-    $log->debug("Search yielded ".scalar(@$recs)." checked, visible results with an approximate visible total of $estimate.",DEBUG);
+    $log->debug(sub{return "Search yielded ".scalar(@$recs)." checked, visible results with an approximate visible total of $estimate." },DEBUG);
 
     for my $rec (@$recs[$offset .. $offset + $limit - 1]) {
         delete $$rec{checked};
@@ -3149,7 +3149,7 @@ sub query_parser_fts {
 
     $client->respond( $summary_row );
 
-    $log->debug("Search yielded ".scalar(@$recs)." checked, visible results with an approximate visible total of $visible.",DEBUG);
+    $log->debug(sub{return "Search yielded ".scalar(@$recs)." checked, visible results with an approximate visible total of $visible." },DEBUG);
 
     for my $rec (@$recs) {
         delete $$rec{checked};
@@ -3197,7 +3197,7 @@ sub query_parser_fts_wrapper {
     if (scalar(keys(%{$args{searches}}))) {
         $log->debug("Constructing QueryParser query from staged search hash ...", DEBUG);
         for my $sclass ( keys %{$args{searches}} ) {
-            $log->debug(" --> staged search key: $sclass --> term: $args{searches}{$sclass}{term}", DEBUG);
+            $log->debug(sub{return " --> staged search key: $sclass --> term: $args{searches}{$sclass}{term}" }, DEBUG);
             $base_query .= " $sclass: $args{searches}{$sclass}{term}";
         }
     }
index d2db7ae..073019f 100644 (file)
@@ -19,7 +19,7 @@ sub _make_mbts {
                 my $lb = undef;
                 for my $b ($x->billings) {
                         next if ($b->voided);
-            #$log->debug( "billing is ".$b->amount, DEBUG );
+            #$log->debug(sub{return "billing is ".$b->amount }, DEBUG );
                         $to += ($b->amount * 100);
                         $lb ||= $b->billing_ts;
                         if ($b->billing_ts ge $lb) {
@@ -35,7 +35,7 @@ sub _make_mbts {
                 my $tp = 0;
                 my $lp = undef;
                 for my $p ($x->payments) {
-            #$log->debug( "payment is ".$p->amount." voided = ".$p->voided, DEBUG );
+            #$log->debug(sub{return "payment is ".$p->amount." voided = ".$p->voided }, DEBUG );
                         next if ($p->voided eq 't');
                         $tp += ($p->amount * 100);
                         $lp ||= $p->payment_ts;
@@ -49,7 +49,7 @@ sub _make_mbts {
                 $s->total_paid( sprintf('%0.2f', ($tp) / 100 ) );
 
                 $s->balance_owed( sprintf('%0.2f', (($to) - ($tp)) / 100) );
-        #$log->debug( "balance of ".$x->id." == ".$s->balance_owed, DEBUG );
+        #$log->debug(sub{return "balance of ".$x->id." == ".$s->balance_owed }, DEBUG );
 
                 if (action::circulation->retrieve($x->id)) {
                     $s->xact_type( 'circulation' );
index 2715571..ff308ab 100644 (file)
@@ -424,7 +424,7 @@ sub cn_browse {
 
             @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
 
-            $logger->debug("Searching for CNs at orgs [".join(',',@ou_ids)."], based on $ou");
+            $logger->debug(sub{return "Searching for CNs at orgs [".join(',',@ou_ids)."], based on $ou" });
         }
     }
 
@@ -552,7 +552,7 @@ sub cn_startwith {
 
     my @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
 
-    $logger->debug("Searching for CNs at orgs [".join(',',@ou_ids)."], based on $ou");
+    $logger->debug(sub{return "Searching for CNs at orgs [".join(',',@ou_ids)."], based on $ou" });
 
     my @list = ();
 
@@ -675,7 +675,7 @@ sub new_books_by_item {
         @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
     }
 
-    $logger->debug("Searching for records with new copies at orgs [".join(',',@ou_ids)."], based on $ou");
+    $logger->debug(sub{return "Searching for records with new copies at orgs [".join(',',@ou_ids)."], based on $ou" });
     my $cns = $_storage->request(
         "open-ils.cstore.json_query.atomic",
         { select    => { acn => ['record'],
@@ -927,7 +927,7 @@ sub tag_sf_browse {
         @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
     }
 
-    $logger->debug("Searching for records at orgs [".join(',',@ou_ids)."], based on $ou");
+    $logger->debug(sub{return "Searching for records at orgs [".join(',',@ou_ids)."], based on $ou" });
 
     my @list = ();
 
@@ -1509,7 +1509,7 @@ sub tag_sf_startwith {
         @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
     }
 
-    $logger->debug("Searching for records at orgs [".join(',',@ou_ids)."], based on $ou");
+    $logger->debug(sub{return "Searching for records at orgs [".join(',',@ou_ids)."], based on $ou" });
 
     my @list = ();
 
@@ -2133,7 +2133,7 @@ sub basic_record_holdings {
 
     my @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
 
-    $logger->debug("Searching for holdings at orgs [".join(',',@ou_ids)."], based on $ou");
+    $logger->debug(sub{return "Searching for holdings at orgs [".join(',',@ou_ids)."], based on $ou" });
 
     for my $cn (@{$tree->call_numbers}) {
         next unless ( $cn->deleted eq 'f' || !$cn->deleted );
@@ -2245,7 +2245,7 @@ sub new_record_holdings {
 
     my @ou_ids = map { $_->{id} } @$orgs;
 
-    $logger->info("Searching for holdings at orgs [".join(',',@ou_ids)."], based on $ou");
+    $logger->info(sub{return "Searching for holdings at orgs [".join(',',@ou_ids)."], based on $ou" });
 
     my %subselect = ( '-or' => [
         { owning_lib => \@ou_ids },
@@ -2375,7 +2375,7 @@ sub new_record_holdings {
 
     $client->respond("</volumes><subscriptions>\n");
 
-    $logger->info("Searching for serial holdings at orgs [".join(',',@ou_ids)."], based on $ou");
+    $logger->info(sub{return "Searching for serial holdings at orgs [".join(',',@ou_ids)."], based on $ou" });
 
     %subselect = ( '-or' => [
         { owning_lib => \@ou_ids },
@@ -2851,7 +2851,7 @@ sub retrieve_metarecord_mods {
         {metarecord => $rid}
     )->gather(1);
 
-    $logger->debug("Adding ".scalar(@$recs)." bib record to the MODS of the metarecord");
+    $logger->debug(sub{return "Adding ".scalar(@$recs)." bib record to the MODS of the metarecord" });
 
     # and retrieve the lead (master) record as MODS
     my ($master) =
index 9027beb..cba2cb5 100644 (file)
@@ -512,7 +512,7 @@ sub create_batch_events {
         my $object_ids = $editor->$method( [$filter, $join], {idlist => 1, timeout => 10800} );
 
         if($object_ids) {
-            $logger->info("trigger: create_batch_events() fetched ".scalar(@$object_ids)." object IDs for def=$def_id / hook=$hook");
+            $logger->info(sub{return "trigger: create_batch_events() fetched ".scalar(@$object_ids)." object IDs for def=$def_id / hook=$hook" });
         } else {
             $logger->warn("trigger: create_batch_events() timeout occurred collecting object IDs for def=$def_id / hook=$hook");
         }
@@ -725,7 +725,7 @@ sub grouped_events {
     my %groups = ( '*' => [] );
 
     if($events) {
-        $logger->info("trigger: grouped_events found ".scalar(@$events)." pending events to process");
+        $logger->info(sub{return "trigger: grouped_events found ".scalar(@$events)." pending events to process" });
     } else {
         $logger->warn("trigger: grouped_events timed out loading pending events");
         return \%groups;
index bd85e38..548db93 100644 (file)
@@ -434,7 +434,7 @@ sub update_state {
         $e->$_($$fields{$_}) for (keys %$fields);
     }
 
-    $log->info( "Retrieved object ".$self->id." for update" );
+    $log->info(sub{return "Retrieved object ".$self->id." for update" });
     $e->start_time( 'now' ) unless $e->start_time;
     $e->update_time( 'now' );
     $e->update_process( $$ );
@@ -455,7 +455,7 @@ sub update_state {
             $log->error( "Update of event ".$self->id." did not return an object" );
             return undef;
         }
-        $log->info( "Update of event ".$e->id." suceeded" );
+        $log->info(sub{return "Update of event ".$e->id." suceeded" });
         $ok = $self->editor->xact_commit if ($self->standalone);
     }
 
@@ -616,10 +616,10 @@ sub _object_by_path {
 
     my $obj = $context->$step(); 
 
-    $logger->debug(
+    $logger->debug(sub{return
         sprintf "_object_by_path(): meth=%s, obj=%s, multi=%s, step=%s, lfield=%s",
         map {defined($_)? $_ : ''} ($meth,  $obj,   $multi,   $step,   $lfield)
-    );
+    });
 
     if (!ref $obj) {
 
index bf6b67e..3d45c9d 100644 (file)
@@ -204,7 +204,7 @@ $_TT_helpers = {
             }
         }
         $primary and unshift @isbns, $primary;
-        $logger->debug("get_li_isbns returning isbns: " . join(', ', @isbns));
+        $logger->debug(sub{return "get_li_isbns returning isbns: " . join(', ', @isbns) });
         return @isbns;
     },
 
@@ -459,7 +459,7 @@ sub run_TT {
         my $t_o = Fieldmapper::action_trigger::event_output->new;
         $t_o->data( ($error) ? $error : $output );
         $t_o->is_error( ($error) ? 't' : 'f' );
-        $logger->info("trigger: writing " . length($t_o->data) . " bytes to template output");
+        $logger->info(sub{return "trigger: writing " . length($t_o->data) . " bytes to template output" });
 
         $env->{EventProcessor}->editor->xact_begin;
         $t_o = $env->{EventProcessor}->editor->create_action_trigger_event_output( $t_o );
index 7ea0198..b9818f5 100644 (file)
@@ -249,9 +249,9 @@ sub handler {
         'inject', $tmpl_output, $filename_fragment, 0
     ); # FIXME: 0 could be seconds-from-epoch UTC if deferred call needed
 
-    $logger->debug(
+    $logger->debug(sub{return
         ref $resp ? ("Response: " . Dumper($resp->value)) : "Error: $resp"
-    );
+    });
 
     if ($resp->{code} and $resp->{code}->value == 200) {
         $eo->is_error('f');
index f06adc8..2d39683 100644 (file)
@@ -50,7 +50,7 @@ sub handler {
     my $ses = OpenSRF::AppSession->connect('open-ils.trigger');
     for (@$circs){
 
-        $logger->info( "AUTORENEW: circ.target_copy: " . Dumper($_->target_copy()) );
+        $logger->info(sub{return "AUTORENEW: circ.target_copy: " . Dumper($_->target_copy()) });
         my $evt = $AppUtils->simplereq(
             'open-ils.circ',
             'open-ils.circ.renew.auto',
index 289a444..bfd7f0c 100644 (file)
@@ -51,8 +51,8 @@ sub handler {
     my $text = $self->run_TT($env);
     return 0 if (!$text);
 
-    $logger->info("StaticEmail Reactor: sending email to ".
-        $$env{params}{recipient}." via SMTP server $smtp");
+    $logger->info(sub{return "StaticEmail Reactor: sending email to ".
+        $$env{params}{recipient}." via SMTP server $smtp" });
 
     my $sender = Email::Send->new({mailer => 'SMTP'});
     $sender->mailer_args([Host => $smtp]);
index 0d5e827..ff66eb9 100644 (file)
@@ -395,12 +395,12 @@ sub verify_url {
         $vcation->req_time('now');
 
         if ($loop_detected) {
-            $logger->info("url: redirect loop detected at " . $cur_url->full_url);
+            $logger->info(sub{return "url: redirect loop detected at " . $cur_url->full_url });
             $vcation->res_code('996');
             $vcation->res_text('Redirect Loop');
 
         } else {
-            $logger->info("url: max redirects reached for source URL " . $url->full_url);
+            $logger->info(sub{return "url: max redirects reached for source URL " . $url->full_url });
             $vcation->res_code('995');
             $vcation->res_text('Max Redirects');
         }
@@ -471,9 +471,9 @@ sub collect_verify_attempt_and_settings {
         $cache{timeout}{$org} = $U->ou_ancestor_setting_value(
             $org, 'url_verify.url_verification_max_wait', $e) || 5;
 
-        $logger->info(
+        $logger->info(sub{return
             sprintf("url: loaded settings delay=%s; max_redirects=%s; timeout=%s",
-                $cache{delay}{$org}, $cache{redirects}{$org}, $cache{timeout}{$org}));
+                $cache{delay}{$org}, $cache{redirects}{$org}, $cache{timeout}{$org}) });
     }
 
     $cache{age}++;
@@ -587,12 +587,12 @@ sub verify_one_url {
     # simple_request avoids LWP's auto-redirect magic
     my $res = $ua->simple_request($req);
 
-    $logger->info(sprintf(
+    $logger->info(sub{return sprintf(
         "url: received HTTP '%s' / '%s' [%s]",
         $res->code,
         $res->message,
         $url_text
-    ));
+    ) });
 
     $vcation->res_code($res->code);
     $vcation->res_text($res->message);
index 4ee6b28..4d0e989 100644 (file)
@@ -1833,7 +1833,7 @@ sub import_record_asset_list_impl {
 
                 # prevent update of unrelated copies
                 if ($copy->call_number->record != $rec->imported_as) {
-                    $logger->info("vl: attempt to overlay unrelated copy=$copy_id; rec=".$rec->imported_as);
+                    $logger->info(sub{return "vl: attempt to overlay unrelated copy=$copy_id; rec=".$rec->imported_as });
 
                     $evt = OpenILS::Event->new('INVALID_IMPORT_COPY_ID', 
                         note => 'Cannot overlay copies for unlinked bib',
@@ -1918,9 +1918,9 @@ sub import_record_asset_list_impl {
                             # label already in use by another call number.
                             # merge the old CN into the new CN
                             
-                            $logger->info(
+                            $logger->info(sub{return
                                 "vl: moving copy to new call number ".
-                                $item->call_number);
+                                $item->call_number });
 
                             my ($mvol, $err) = 
                                 OpenILS::Application::Cat::Merge::merge_volumes(
@@ -1940,9 +1940,9 @@ sub import_record_asset_list_impl {
                             ]);
 
                         } else {
-                            $logger->info(
+                            $logger->info(sub{return
                                 "vl: updating copy call number label".
-                                $item->call_number);
+                                $item->call_number });
 
                             $copy->call_number->label($item->call_number);
                             if (!$e->update_asset_call_number($copy->call_number)) {
@@ -2077,7 +2077,7 @@ sub import_record_asset_list_impl {
             }
 
             if ($item->stat_cat_data) {
-                $logger->info("vl: parsing stat cat data: " . $item->stat_cat_data);
+                $logger->info(sub{return "vl: parsing stat cat data: " . $item->stat_cat_data });
                 my @stat_cat_pairs = split('\|\|', $item->stat_cat_data);
                 my $stat_cat_entries = [];
                 # lookup stat cats
@@ -2116,7 +2116,7 @@ sub import_record_asset_list_impl {
             }
 
             if ($item->parts_data) {
-                $logger->info("vl: parsing parts data: " . $item->parts_data);
+                $logger->info(sub{return "vl: parsing parts data: " . $item->parts_data });
                 my @parts = split('\|', $item->parts_data);
                 my $part_objs = [];
                 foreach my $part_label (@parts) {
@@ -2170,7 +2170,7 @@ sub import_record_asset_list_impl {
             $e->commit;
             $$report_args{in_count}++;
             respond_with_status($report_args);
-            $logger->info("vl: successfully imported item " . $item->barcode);
+            $logger->info(sub{return "vl: successfully imported item " . $item->barcode });
         }
     }
 
@@ -2201,7 +2201,7 @@ sub apply_import_item_defaults {
             my $pfx = $set->('barcode.prefix') || 'VAN';
             my $barcode = $pfx . $item->record . $item->id;
 
-            $logger->info("vl: using auto barcode $barcode for ".$item->id);
+            $logger->info(sub{return "vl: using auto barcode $barcode for ".$item->id });
             $item->barcode($barcode);
 
         } else {
@@ -2221,7 +2221,7 @@ sub apply_import_item_defaults {
                 $auto_cn->{$org} = $pfx . $item->record . $item->id;
             }
 
-            $logger->info("vl: using auto call number ".$auto_cn->{$org});
+            $logger->info(sub{return "vl: using auto call number ".$auto_cn->{$org} });
             $item->call_number($auto_cn->{$org});
 
         } else {
@@ -2243,7 +2243,7 @@ sub respond_with_status {
     if($error or $evt) {
 
         my $item = $$args{import_item};
-        $logger->info("vl: unable to import item " . $item->barcode);
+        $logger->info(sub{return "vl: unable to import item " . $item->barcode });
 
         $error ||= 'general.unknown';
         $item->import_error($error);
index 6474586..e51e091 100644 (file)
@@ -98,7 +98,7 @@ sub request {
     };
 
     if ($res->status_line =~ /timeout/) {
-        $logger->info("HTTPClient: timeout error: " . $res->status_line);
+        $logger->info(sub{return "HTTPClient: timeout error: " . $res->status_line });
         return undef;
     }
 
index 44685cf..412c5ac 100644 (file)
@@ -156,8 +156,8 @@ sub init {
     $self->{retarget_time} = DateTime->now(time_zone => 'local')
         ->subtract(seconds => $retarget_seconds);
 
-    $logger->info("Using retarget time: ".
-        $self->{retarget_time}->strftime('%F %T%z'));
+    $logger->info(sub{return "Using retarget time: ".
+        $self->{retarget_time}->strftime('%F %T%z') });
 
     if ($self->{soft_retarget_interval}) {
 
@@ -167,8 +167,8 @@ sub init {
         $self->{soft_retarget_time} = 
             DateTime->now(time_zone => 'local')->subtract(seconds => $secs);
 
-        $logger->info("Using soft retarget time: " .
-            $self->{soft_retarget_time}->strftime('%F %T%z'));
+        $logger->info(sub{return "Using soft retarget time: " .
+            $self->{soft_retarget_time}->strftime('%F %T%z') });
     }
 
     # Holds targeted in the current targeter instance not be retargeted
@@ -199,7 +199,7 @@ sub init {
     });
 
     my @closed_orgs = map {$_->org_unit} @$closed;
-    $logger->info("closed org unit IDs: @closed_orgs");
+    $logger->info(sub{return "closed org unit IDs: @closed_orgs" });
 
     # Map of org id to 1. Any org in the map is closed.
     $self->{closed_orgs} = {map {$_ => 1} @closed_orgs};
index d2e92aa..eae143a 100644 (file)
@@ -155,8 +155,8 @@ sub get_field_value {
             }
         }
     } otherwise {
-        $logger->info("MODS-izing failure: ".shift());
-        $logger->info("Failed MODS xml: ".$root->toString);
+        $logger->info(sub{return "MODS-izing failure: ".shift() });
+        $logger->info(sub{return "Failed MODS xml: ".$root->toString });
         $logger->info("Failed MODS xpath: $xpath");
     };
     return @string;
index b4a8f1e..e78fbf5 100644 (file)
@@ -120,7 +120,7 @@ sub local_keyfiles {
     $logger->info("Checking for SSH keyfiles" . ($force ? ' (ignoring cache)' : ''));
     %keyfiles = ();  # reset to empty
     my @dirs = plausible_dirs();
-    $logger->debug(scalar(@dirs) . " plausible dirs: " . join(', ', @dirs));
+    $logger->debug(sub{return scalar(@dirs) . " plausible dirs: " . join(', ', @dirs) });
     foreach my $dir (@dirs) {
         foreach my $key (qw/rsa dsa/) {
             my $private = "$dir/id_$key";
@@ -316,7 +316,7 @@ sub ls {
         return $self->ls_ftp(@targets);
     } else {
         my %keys = $self->key_check($params);
-        # $logger->info("*** calling ls_ssh2(keys, '" . join("', '", (scalar(@targets) ? map {defined $_ ? $_ : '' } @targets : ())) . "') with ssh keys");
+        # $logger->info(sub{return "*** calling ls_ssh2(keys, '" . join("', '", (scalar(@targets) ? map {defined $_ ? $_ : '' } @targets : ())) . "') with ssh keys" });
         return $self->ls_ssh2(\%keys, @targets);
     }
 }
@@ -445,11 +445,11 @@ sub put_ssh2 {
         return;
     }
     
-    $logger->info("*** attempting put (" . join(", ", @_) . ") with ssh keys");
+    $logger->info(sub{return "*** attempting put (" . join(", ", @_) . ") with ssh keys" });
     my $ssh2 = $self->_ssh2($keys) or return;
     my $res;
     if ($res = $ssh2->scp_put( @_ )) {
-        $logger->info(_pkg("successfully sent", $self->remote_host, join(' --> ', @_ )));
+        $logger->info(sub{return _pkg("successfully sent", $self->remote_host, join(' --> ', @_ )) });
         return $res;
     }
     $logger->error($self->_error(sprintf "put with keys to %s failed with error: $!", $self->remote_host));
@@ -464,12 +464,12 @@ sub get_ssh2 {
         return;
     }
     
-    $logger->info("*** get args: " . Dumper(\@_));
-    $logger->info("*** attempting get (" . join(", ", map {$_ =~ /\S/ ? $_ : '*Object'} map {defined($_) ? $_ : '*Object'} @_) . ") with ssh keys");
+    $logger->info(sub{return "*** get args: " . Dumper(\@_) });
+    $logger->info(sub{return "*** attempting get (" . join(", ", map {$_ =~ /\S/ ? $_ : '*Object'} map {defined($_) ? $_ : '*Object'} @_) . ") with ssh keys" });
     my $ssh2 = $self->_ssh2($keys) or return;
     my $res;
     if ($res = $ssh2->scp_get( @_ )) {
-        $logger->info(_pkg("successfully got", $self->remote_host, join(' --> ', @_ )));
+        $logger->info(sub{return _pkg("successfully got", $self->remote_host, join(' --> ', @_ )) });
         return $res;
     }
     $logger->error($self->_error(sprintf "get with keys from %s failed with error: $!", $self->remote_host));
@@ -488,7 +488,7 @@ sub ls_ssh2_full {
     my $keys = shift;    # could have many keypairs here
     my @targets = grep {defined} @_;
 
-    $logger->info("*** attempting ls ('" . join("', '", @targets) . "') with ssh keys");
+    $logger->info(sub{return "*** attempting ls ('" . join("', '", @targets) . "') with ssh keys" });
     my $ssh2 = $self->_ssh2($keys) or return;
     my $sftp = $ssh2->sftp         or return;
 
@@ -515,7 +515,7 @@ sub ls_ssh2_full {
         if ($regex) {
             my $count = scalar(@pool);
             @pool = grep {$_->{name} =~ /$regex/} @pool;
-            $logger->info("SSH ls: Glob regex($regex) matches " . scalar(@pool) . " of $count files"); 
+            $logger->info(sub{return "SSH ls: Glob regex($regex) matches " . scalar(@pool) . " of $count files" }); 
         } # else { $logger->info("SSH ls: No Glob regex in '$target'.  Just a regular ls"); }
         push @list, @pool;
     }
@@ -592,12 +592,12 @@ sub put_ftp {
     }
 
     $self->remote_file($filename);
-    $logger->info(
+    $logger->info(sub{return
         _pkg(
             "successfully sent", $self->remote_host, $self->local_file, '-->',
             $filename
         )
-    );
+    });
     return $filename;
 }
 
@@ -627,12 +627,12 @@ sub get_ftp {
     }
 
     $self->local_file($filename);
-    $logger->info(
+    $logger->info(sub{return
         _pkg(
             "successfully retrieved $filename <--", $self->remote_host . '/' .
             $self->remote_file
         )
-    );
+    });
     return $self->local_file;
 }
 
@@ -670,7 +670,7 @@ sub ls_ftp {   # returns full path like: dir/path/file.ext
                         my ($vol, $dir, $file) = File::Spec->splitpath($_);
                         $file =~ /$regex/
                     } @part;  
-            $logger->info("FTP ls: Glob regex($regex) matches " . scalar(@part) . " of $count files");
+            $logger->info(sub{return "FTP ls: Glob regex($regex) matches " . scalar(@part) . " of $count files" });
         } #  else {$logger->info("FTP ls: No Glob regex in '$_'.  Just a regular ls");}
         push @list, @part;
     }
index 254d790..2a5ac63 100644 (file)
@@ -290,7 +290,7 @@ sub get_url {
     my $agent = LWP::UserAgent->new(timeout => $net_timeout);
 
     my $res = $agent->get($url); 
-    $logger->info("added content request returned with code " . $res->code);
+    $logger->info(sub{return "added content request returned with code " . $res->code });
     die "added content request failed: " . $res->status_line ."\n" unless $res->is_success;
 
     return $res;
@@ -304,7 +304,7 @@ sub post_url {
     my $agent = LWP::UserAgent->new(timeout => $net_timeout);
 
     my $res = $agent->post($url, Content => $content);
-    $logger->info("added content request returned with code " . $res->code);
+    $logger->info(sub{return "added content request returned with code " . $res->code });
     die "added content request failed: " . $res->status_line ."\n" unless $res->is_success;
 
     return $res;
index c2c2cc6..351db22 100644 (file)
@@ -361,7 +361,7 @@ sub fetch_cover_response {
     # Seems unlikely, but might as well try.
     my $items = $response->{items};
 
-    $logger->debug("$key: items request got " . scalar(@$items) . " items back");
+    $logger->debug(sub{return "$key: items request got " . scalar(@$items) . " items back" });
 
     foreach my $item (@$items) {
         if (exists $item->{cover}->{$size}) {
index 3ec7900..18e8321 100644 (file)
@@ -90,10 +90,10 @@ sub local_avail_concern {
             "open-ils.circ",
             "open-ils.circ.hold.has_copy_at", $self->editor->authtoken, $args
         );
-        $logger->info(
+        $logger->info(sub{return
             "copy availability information for " . Dumper($args) .
             " is " . Dumper($local_avail)
-        );
+        });
         if (%$local_avail) { # if hash not empty
             $self->ctx->{hold_copy_available} = $local_avail;
             return ($would_block, $would_alert);
@@ -1066,7 +1066,7 @@ sub load_place_hold {
         }
     }
 
-    $logger->info("Looking at hold_type: " . $ctx->{hold_type} . " and targets: @targets");
+    $logger->info(sub{return "Looking at hold_type: " . $ctx->{hold_type} . " and targets: @targets" });
 
     $ctx->{staff_recipient} = $self->editor->retrieve_actor_user([
         $e->requestor->id,
@@ -1409,7 +1409,7 @@ sub attempt_hold_placement {
         while (my $resp = $breq->recv) {
 
             $resp = $resp->content;
-            $logger->info('batch hold placement result: ' . OpenSRF::Utils::JSON->perl2JSON($resp));
+            $logger->info(sub{return 'batch hold placement result: ' . OpenSRF::Utils::JSON->perl2JSON($resp) });
 
             if ($U->event_code($resp)) {
                 $ctx->{general_hold_error} = $resp;
@@ -1926,7 +1926,7 @@ sub load_myopac_pay_init {
     my $token = md5_hex($$ . time() . rand());
     $cache->put_cache($token, $cache_args, 30);
 
-    $logger->info("tpac caching payment info with token $token and xacts [@payment_xacts]");
+    $logger->info(sub{return "tpac caching payment info with token $token and xacts [@payment_xacts]" });
 
     # after we render the processing page, we quickly redirect to submit
     # the actual payment.  The refresh url contains the payment token.
@@ -1965,14 +1965,14 @@ sub load_myopac_pay {
     return Apache2::Const::HTTP_BAD_REQUEST unless
         $cache_args->{user} == $self->ctx->{user}->id;
 
-    $logger->info("tpac paying fines with token $token and xacts [@payment_xacts]");
+    $logger->info(sub{return "tpac paying fines with token $token and xacts [@payment_xacts]" });
 
     my $r;
     $r = $self->prepare_fines(undef, undef, \@payment_xacts) and return $r;
 
     # balance_owed is computed specifically from the fines we're paying
     if ($self->ctx->{fines}->{balance_owed} <= 0) {
-        $logger->info("tpac can't pay non-positive balance. xacts selected: [@payment_xacts]");
+        $logger->info(sub{return "tpac can't pay non-positive balance. xacts selected: [@payment_xacts]" });
         return Apache2::Const::HTTP_BAD_REQUEST;
     }
 
@@ -2626,7 +2626,7 @@ sub load_myopac_bookbag_update {
         }
 
         return Apache2::Const::OK unless @hold_recs;
-        $logger->info("placing holds from list page on: @hold_recs");
+        $logger->info(sub{return "placing holds from list page on: @hold_recs" });
 
         my $url = $self->ctx->{opac_root} . '/place_hold?hold_type=T';
         $url .= ';hold_target=' . $_ for @hold_recs;
@@ -2924,7 +2924,7 @@ sub load_password_reset {
                     'open-ils.actor.patron.password_reset.commit',
                     $uuid, $pwd1);
 
-                $logger->info("patron password reset response " . Dumper($response));
+                $logger->info(sub{return "patron password reset response " . Dumper($response) });
 
                 if ($U->event_code($response)) { # non-success event
 
@@ -2965,7 +2965,7 @@ sub load_password_reset {
         $ctx->{pwreset} = {status => 'REQUEST_SUCCESS'};
     }
 
-    $logger->info("patron password reset resulted in " . Dumper($ctx->{pwreset}));
+    $logger->info(sub{return "patron password reset resulted in " . Dumper($ctx->{pwreset}) });
     return Apache2::Const::OK;
 }
 
index c21566a..b47e598 100644 (file)
@@ -475,7 +475,7 @@ sub load_rresults {
     $ctx->{superpage_size} = $results->{superpage_size};
     $ctx->{pagable_limit} = $results->{core_limit};
     $ctx->{query_struct} = $results->{global_summary}{query_struct};
-    $logger->debug('query struct: '. Dumper($ctx->{query_struct}));
+    $logger->debug(sub{return 'query struct: '. Dumper($ctx->{query_struct}) });
     $ctx->{canonicalized_query} = $results->{global_summary}{canonicalized_query};
     $ctx->{search_summary} = $results->{global_summary};
 
@@ -710,7 +710,7 @@ sub marc_expert_search {
         };
     }
 
-    $logger->info("query for expert search: " . Dumper($query));
+    $logger->info(sub{return "query for expert search: " . Dumper($query) });
 
     $self->timelog("Getting search parameters");
     # loc, limit and offset
index 5b1032c..556981d 100644 (file)
@@ -119,7 +119,7 @@ sub query {
                 $ahn->notify_staff($self->user);
                 $ahn->method('phone');
                 $ahn->note('PhoneList.pm');
-                $logger->activity("Attempting notification creation hold: " . $ahn->hold . " method: " . $ahn->method . " note: " . $ahn->note);
+                $logger->activity(sub{return "Attempting notification creation hold: " . $ahn->hold . " method: " . $ahn->method . " note: " . $ahn->note });
                 my $notification = $U->simplereq('open-ils.circ', 'open-ils.circ.hold_notification.create', $self->authtoken, $ahn);
                 if (ref($notification)) {
                     $logger->error("Error creating notification: " . $notification->{textcode});
index c0533db..4c4dd5d 100644 (file)
@@ -153,7 +153,7 @@ sub redirect_libs {
 
         for my $block (@{$lib_ips_hash->{$shortname}}) {
 
-            $logger->debug("Checking whether " . $source_ip->ip() . " is in the range " . $block->[0] . " to " . $block->[1]);
+            $logger->debug(sub{return "Checking whether " . $source_ip->ip() . " is in the range " . $block->[0] . " to " . $block->[1] });
             if(defined($block->[0]) && defined($block->[1]) ) {
                 my $range = new Net::IP( $block->[0] . ' - ' . $block->[1] );
                 if( $source_ip->overlaps($range)==$IP_A_IN_B_OVERLAP ||
index b43d266..bfafa38 100644 (file)
@@ -1455,7 +1455,7 @@ sub opensearch_feed {
         } => $query_terms => 1
     )->gather(1);
 
-    $log->debug("Hits for [$terms]: $recs->{count}");
+    $log->debug(sub{return "Hits for [$terms]: $recs->{count}" });
 
     my $feed = create_record_feed(
         'record',
@@ -2161,7 +2161,7 @@ sub sru_search {
 
             if ( exists($qualifier_map{$qset}{$qname}) ) {
                 $qualifier = $qualifier_map{$qset}{$qname}{'index'} || 'kw';
-                $log->debug("SRU toEvergreen: $qset, $qname   $qualifier_map{$qset}{$qname}{'index'}\n");
+                $log->debug(sub{return "SRU toEvergreen: $qset, $qname   $qualifier_map{$qset}{$qname}{'index'}\n" });
             }
 
             my @modifiers = $relation->getModifiers();
@@ -2204,7 +2204,7 @@ sub sru_search {
 
             if ( exists($OpenILS::WWW::SuperCat::nested_auth_qualifier_map{$qset}{$qname}) ) {
                 $qualifier = $OpenILS::WWW::SuperCat::nested_auth_qualifier_map{$qset}{$qname}{'index'} || 'author';
-                $log->debug("SRU toEvergreenAuth: $qset, $qname   $OpenILS::WWW::SuperCat::nested_auth_qualifier_map{$qset}{$qname}{'index'}\n");
+                $log->debug(sub{return "SRU toEvergreenAuth: $qset, $qname   $OpenILS::WWW::SuperCat::nested_auth_qualifier_map{$qset}{$qname}{'index'}\n" });
             }
         }
         return { qualifier => $qualifier, term => $term };
index 43e99e4..5e8940e 100644 (file)
@@ -44,7 +44,7 @@ sub child_init {
     my $idl = $sclient->config_value("IDL");
     $services = $sclient->config_value("xml-rpc", "allowed_services", "service");
     $services = ref $services ? $services : [ $services ];
-    $logger->debug("XML-RPC: allowed services @$services");
+    $logger->debug(sub{return "XML-RPC: allowed services @$services" });
     OpenILS::Utils::Fieldmapper->require;
     Fieldmapper->import(IDL => $idl);
     OpenSRF::AppSession->ingress('apache');
@@ -70,7 +70,7 @@ sub handler {
     my $method = $request->name;
 
     warn "XML-RPC: service=$service, method=$method, args=@args\n";
-    $logger->debug("XML-RPC: service=$service, method=$method, args=@args");
+    $logger->debug(sub{return "XML-RPC: service=$service, method=$method, args=@args" });
 
     my $perl = run_request( $service, $method, @args );
     my $resp = RPC::XML::response->new(smart_encode($perl));
index 72edf18..08b9f47 100755 (executable)
@@ -249,7 +249,7 @@ for my $r ( @reports ) {
                          WHERE id = ?;
                SQL
 
-           $logger->debug('Report SQL: ' . $r->{resultset}->toSQL);
+           $logger->debug(sub{return 'Report SQL: ' . $r->{resultset}->toSQL });
                $sth = $data_dbh->prepare($r->{resultset}->toSQL);
 
                $sth->execute;
index ba0e2aa..b981056 100755 (executable)
@@ -134,7 +134,7 @@ sub push_file_to_acq {
     my $file = shift;
     my $args = shift;
 
-    $logger->info("acq-or: pushing file '$file' to provider " . $args->{provider});
+    $logger->info(sub{return "acq-or: pushing file '$file' to provider " . $args->{provider} });
 
     # Cache the file name like Vandelay does.  ACQ will 
     # read contents of the cache and then delete them.
@@ -271,7 +271,7 @@ sub check_provider_files {
     # ignore '.', '..', and hidden files
     @files = grep {$_ !~ /^\./} @files;
 
-    $logger->info("acq-or: found " . scalar(@files) . " ACQ order files at $dirname");
+    $logger->info(sub{return "acq-or: found " . scalar(@files) . " ACQ order files at $dirname" });
 
     # return the file names w/ full path
     return map {File::Spec->catfile($dirname, $_)} @files;
index c777cfe..7e13d54 100755 (executable)
@@ -175,7 +175,7 @@ sub process_hooks {
         }
 
         if(@event_ids) {
-            $logger->info("at_runner: created ".scalar(@event_ids)." events for $debug_hook");
+            $logger->info(sub{return "at_runner: created ".scalar(@event_ids)." events for $debug_hook" });
         } elsif($req->complete) {
             $logger->info("at_runner: no events to create for $debug_hook");
         } else {
index 4f2a1df..a7cbb5c 100755 (executable)
@@ -303,7 +303,7 @@ sub compile_vandelay_ops {
             $vl_ops->{auto_overlay_best_match}
         );
 
-    $logger->info("VL options: ".Dumper($vl_ops)) if $verbose;
+    $logger->info(sub{return "VL options: ".Dumper($vl_ops) }) if $verbose;
     return $vl_ops;
 }
 
@@ -361,9 +361,9 @@ sub import_queued_records {
                 # no errors, just didn't import, because of rules.
 
                 $failed++;
-                $logger->info(
+                $logger->info(sub{return
                     "record failed to satisfy Vandelay merge/quality/etc. ".
-                    "requirements: " . ($data->{imported} || ''));
+                    "requirements: " . ($data->{imported} || '') });
 
             } else {
                 push(@cleanup_recs, $data->{imported}) if $data->{imported};
@@ -394,7 +394,7 @@ sub import_queued_records {
     $pcrud->request('open-ils.pcrud.transaction.commit', $authtoken)->recv unless $err;
     $pcrud->disconnect;
 
-    $logger->info("imported queued vandelay records: @cleanup_recs");
+    $logger->info(sub{return "imported queued vandelay records: @cleanup_recs" });
     return (scalar(@cleanup_recs), $failed);
 }
 
@@ -438,7 +438,7 @@ sub process_request {
         return;
     } 
 
-    $logger->info("stream parser read " . length($data) . " bytes");
+    $logger->info(sub{return "stream parser read " . length($data) . " bytes" });
 
     set_tempdir();
 
index c5da523..3f040b6 100755 (executable)
@@ -73,7 +73,7 @@ sub rollover_events_phone_to_print {
             $rollover_map{$event->event_def},
             $event->target
         )) {
-            $logger->info("rollover created event $new_id from event " . $event->id);
+            $logger->info(sub{return "rollover created event $new_id from event " . $event->id });
             push @$finished, $event->id;
         }
     }