Ruby on Rails latest stable (v5.2.3) - 1 note

Module deprecated or moved

This module is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.

No documentation

This module has no description. You can help the Ruby on Rails community by adding new notes.

Show files where this module is defined (1 file)
Register or log in to add new notes.
July 1, 2008
5 thanks

benchmark and silence methods

benchmark (title, log_level = Logger::DEBUG, use_silence = true) {|| …}

Log and benchmark the workings of a single block and silence whatever logging that may have happened inside it (unless use_silence is set to false).

The benchmark is only recorded if the current level of the logger matches the log_level, which makes it easy to include benchmarking statements in production software that will remain inexpensive because the benchmark will only be conducted if the log level is low enough.

silence () {|| …}

Silences the logger for the duration of the block. To silence the logger in your controller, simply use:

NameOfController.logger.silence do

# your code here...