lib/kanina/logger.rb in kanina-0.6.0 vs lib/kanina/logger.rb in kanina-0.6.1

- old
+ new

@@ -1,16 +1,22 @@ require 'logger' module Kanina - # Simplifies sending messages to standard output and/or the Rails log files. + # `Kanina::Logger` simplifies sending messages to standard output and/or the + # Rails log files. module Logger DEFAULT_LOG_LEVEL = ::Logger::INFO + # Sets up the Rails logger + # @return [Rails::Logger] the logger being used def logger Rails.logger ||= ::Logger.new(STDOUT) @logger ||= Rails.logger end + # Sends a message to the log + # @param text [String] the message to log + # @param level the importance of the logged message. Default is Logger::INFO def say(text, level = DEFAULT_LOG_LEVEL) puts text if @loud logger.add level, "HARE: #{text}" end end