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(
{
} 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);
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);
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(
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 = {
$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");
$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");
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 ) {
$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");
$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;
$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;
$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};
}
$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 );
}
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)",
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;
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";
$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)) {
# 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: " .
# 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
);
}
- $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);
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;
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);
}
}
$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;
# 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) {
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.
}
$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);
$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,
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({
$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
);
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
$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
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;
{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;
} 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;
}
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;
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;
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;
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);
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);
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);
# 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;
$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);
}
}
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;
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;
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);
}
});
- $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;
$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;
}
$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;
}
# 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];
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);
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);
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 );
$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;
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);
$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;
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) {
( $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;
# 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;
# 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' );
}
{ 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 {
my $restrict_by_ou = $authenticator->{restrict_by_home_ou};
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
- );
+ });
}
}
}
# 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];
}
} else {
$result = (sort @$id_list)[0];
}
- $logger->info(
+ $logger->info(sub{return
"best_bresv_candidate from " . join(",", @$id_list) . ": $result"
- );
+ });
return $result;
}
$bresv->target_resource_type->catalog_item eq "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;
}
$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 {
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");
$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;
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);
}
$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;
}
}
$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;
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');
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 ] },
} 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;
}
}
$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 {
# 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');
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;
} 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;
$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;
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;
$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;
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
}
}
- $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);
# 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);
}
}
- $logger->info("marc create/import created new record ".$record->id);
+ $logger->info(sub{return "marc create/import created new record ".$record->id });
return $record;
}
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
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
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);
}
}
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');
$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;
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');
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');
}
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);
}
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)) {
$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(
}
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");
}
);
- $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);
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;
} 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 ) . "]" });
}
}
}
# 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;
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;
}
$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});
&& $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;
}
# 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;
$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};
}
{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);
}
}
}
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;
}
);
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]);
}
}
($_->{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);
}
$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})) {
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);
}
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);
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;
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);
# 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
unless $self->editor->allowed('CREATE_PRECAT') || $self->is_renewal;
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');
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);
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
" 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;
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;
}
}
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;
}
}
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;
}
$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)
$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;
}
}
}
- $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');
} 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;
}
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
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);
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;
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;
}
$self->copy_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" });
}
}
]);
- $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
);
}
- $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);
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";
}
$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;
}
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);
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]);
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(
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
}
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;
}
# 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));
}
$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});
}
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});
}
}, {"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) {
$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} );
}
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;
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"};
%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;
}
}
);
- $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(
$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;
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(
}
);
- $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) {
$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;
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(
}
);
- $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) {
$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;
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(
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) {
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,
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');
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;
# 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)
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;
}
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;
}
);
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
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;
}
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',
$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();
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 );
}
$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 ));
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);
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(
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;
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 {
$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(
$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(
$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(
$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,
};
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");
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},
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 {
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},
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 {
# Send the request.
my $res = $self->request($req, $self->{session_id}, $do_not_redirect);
- $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/) {
);
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 } );
}
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 },
$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) {
}
);
- $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;
}
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);
}
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;
}
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);
}
$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;
}
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;
}
# 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 ) {
$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');
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]" });
}
}
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);
}
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;
}
$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;
}
}
$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;
}
$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;
}
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;
}
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 },
}
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;
}
$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;
}
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;
}
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 },
}
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;
}
);
}
- $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;
}
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;
}
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};
);
}
}
- $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;
}
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;
# 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({
'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;
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'}}) {
}
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(
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;
}
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;
}
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 },
}
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;
}
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
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;
}
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 },
}
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(
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;
}
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;
}
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 }
}
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(
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;
}
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;
}
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 }
}
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;
$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 }
{"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
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);
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 );
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;
}
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;
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);
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 @finds = sort keys %$search;
my @sets = sort keys %$arg;
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,@_);
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');
$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 ");
}
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) {
$$primary{host} ||= 'localhost';
$$primary{db} ||= 'openils';
- $log->debug("Attempting to connect to $$primary{db} at $$primary{host}", INFO);
+ $log->debug(sub{return "Attempting to connect to $$primary{db} at $$primary{host}" }, INFO);
try {
$primary_db = DBI->connect(
throw $e;
};
- $log->debug("Connected to primary db $$primary{db} at $$primary{host}", INFO);
+ $log->debug(sub{return "Connected to primary db $$primary{db} at $$primary{host}" }, INFO);
$primary_db->do("SET NAMES '$$primary{client_encoding}';") if ($$primary{client_encoding});
$standby_dbs[-1]->do("SET NAMES '$$db{client_encoding}';") if ($$primary{client_encoding});
- $log->debug("Connected to primary db '$$primary{db} at $$primary{host}", INFO);
+ $log->debug(sub{return "Connected to primary db '$$primary{db} at $$primary{host}" }, INFO);
}
$log->debug("All is well on the western front", INTERNAL);
__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;
}
$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;
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})
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;
}
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) {
$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];
}
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);
$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 =>
$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;
$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();
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 );
) || 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
#$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.
$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
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,
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
))
) {
$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" );
}
$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,
)->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};
)->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};
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));
# 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));
$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 {
$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();
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
$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] }
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,
$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'
$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 {
$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);
);
} 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);
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;
# 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);
$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);
# 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);
$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;
@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;
@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);
# ($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);
@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]) {
$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};
$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};
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}";
}
}
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) {
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;
$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' );
@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 @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 = ();
@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'],
@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 = ();
@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 = ();
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 );
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 },
$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 },
{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) =
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");
}
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;
$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( $$ );
$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);
}
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) {
}
}
$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;
},
$t_o->data( ($error) ? $error : $output );
$t_o->is_error( ($error) ? 't' : 'f' );
$t_o->locale($env->{tt_locale});
- $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 );
'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');
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',
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]);
$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');
}
$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}++;
# 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);
# 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',
# 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(
]);
} 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)) {
}
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
}
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) {
$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 });
}
}
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 {
$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 {
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);
};
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;
}
$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}) {
$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
});
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};
}
}
} 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;
$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";
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);
}
}
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));
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));
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;
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;
}
}
$self->remote_file($filename);
- $logger->info(
+ $logger->info(sub{return
_pkg(
"successfully sent", $self->remote_host, $self->local_file, '-->',
$filename
)
- );
+ });
return $filename;
}
}
$self->local_file($filename);
- $logger->info(
+ $logger->info(sub{return
_pkg(
"successfully retrieved $filename <--", $self->remote_host . '/' .
$self->remote_file
)
- );
+ });
return $self->local_file;
}
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;
}
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;
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;
# 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}) {
"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);
}
}
- $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,
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;
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.
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;
}
}
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;
'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
$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;
}
$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};
};
}
- $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
$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});
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 ||
} => $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',
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();
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 };
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');
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));
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;
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.
# 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;
}
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 {
$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;
}
# 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};
$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);
}
return;
}
- $logger->info("stream parser read " . length($data) . " bytes");
+ $logger->info(sub{return "stream parser read " . length($data) . " bytes" });
set_tempdir();
$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;
}
}