8784: Fix test for latest firefox.
[arvados.git] / services / api / lib / log_reuse_info.rb
1 module LogReuseInfo
2   # log_reuse_info logs whatever the given block returns, if
3   # log_reuse_decisions is enabled. It accepts a block instead of a
4   # string because in some cases constructing the strings involves
5   # doing expensive things like database queries, and we want to skip
6   # those when logging is disabled.
7   def log_reuse_info(candidates=nil)
8     if Rails.configuration.log_reuse_decisions
9       msg = yield
10       if !candidates.nil?
11         msg = "have #{candidates.count} candidates " + msg
12       end
13       Rails.logger.info("find_reusable: " + msg)
14     end
15   end
16 end