X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/627fbeb0406fcdd9cdc9e90a6e9529f48dc37321..e38ac44d14e9006c24c93bca9de1ee299b16d367:/services/api/lib/log_reuse_info.rb diff --git a/services/api/lib/log_reuse_info.rb b/services/api/lib/log_reuse_info.rb index 1bf050a777..ed5cc82bfd 100644 --- a/services/api/lib/log_reuse_info.rb +++ b/services/api/lib/log_reuse_info.rb @@ -1,12 +1,20 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + module LogReuseInfo # log_reuse_info logs whatever the given block returns, if # log_reuse_decisions is enabled. It accepts a block instead of a # string because in some cases constructing the strings involves - # doing database queries, and we want to skip those queries when - # logging is disabled. - def log_reuse_info + # doing expensive things like database queries, and we want to skip + # those when logging is disabled. + def log_reuse_info(candidates=nil) if Rails.configuration.log_reuse_decisions - Rails.logger.info("find_reusable: " + yield) + msg = yield + if !candidates.nil? + msg = "have #{candidates.count} candidates " + msg + end + Rails.logger.info("find_reusable: " + msg) end end end