Skip to the content.

info.rb(logger)

Ref. https://docs.ruby-lang.org/ja/latest/library/logger.html

Execution:

require 'logger'
#=> true

logger = Logger.new(STDOUT)
#=> 
#<Logger:0x00007f3ab7318258


puts "Level INFO"
Level INFO
#=> nil
logger.level = Logger::INFO # <= change level
#=> 1

logger.warn("Nothing to do!") # output
W, [2024-12-08T04:08:16.297425 #2481]  WARN -- : Nothing to do!
#=> true
logger.info("Program started") # output
I, [2024-12-08T04:08:16.297725 #2481]  INFO -- : Program started
#=> true
logger.debug("Created logger") # none
#=> true

Executed with Ruby 3.3.6