# 1. Import the Logger class from the Ruby standard library
require 'logger'
# 2. Create a new instance of the Logger class, specifying STDOUT as the output stream
logger = Logger.new(STDOUT)
# 3. Set the logging level to control which messages are logged
logger.level = Logger::INFO
# 4. Log an informational message
logger.info('This is an informational message.')
# 5. Log a warning message
logger.warn('This is a warning message.')
# 6. Log an error message
logger.error('This is an error message.')
# 7. Log a debug message (note: won't be displayed if the logging level is set above DEBUG)
logger.debug('This is a debug message.')