Module: Kanina::Logger

Included in:
Server, Subscription
Defined in:
lib/kanina/logger.rb

Overview

Simplifies sending messages to standard output and/or the Rails log files.

Constant Summary collapse

DEFAULT_LOG_LEVEL =
::Logger::INFO

Instance Method Summary collapse

Instance Method Details

#loggerObject


8
9
10
11
# File 'lib/kanina/logger.rb', line 8

def logger
  Rails.logger ||= ::Logger.new(STDOUT)
  @logger ||= Rails.logger
end

#say(text, level = DEFAULT_LOG_LEVEL) ⇒ Object


13
14
15
16
# File 'lib/kanina/logger.rb', line 13

def say(text, level = DEFAULT_LOG_LEVEL)
  puts text if @loud
  logger.add level, "HARE: #{text}"
end