Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Logger#with_level

with_level(severity) { || ... }

Adjust the log level during the block execution for the current Fiber only

Example
logger.with_level(:debug) do
  logger.debug { "Hello" }
end
See also #warn? #warn! also in 3.3