11590: Log container reuse decisions.
[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 database queries, and we want to skip those queries when
6   # logging is disabled.
7   def log_reuse_info
8     if Rails.configuration.log_reuse_decisions
9       Rails.logger.info("find_reusable: " + yield)
10     end
11   end
12 end