Module: OptAR::Logger

Defined in:
lib/opt_ar/logger.rb

Overview

Log implementation for the gem

Tries to use ActiveRecord::Base.logger which is compatible with rails

else, fallbacks to STDOUT

Class Method Summary collapse

Class Method Details

.log(msg, level = :info) ⇒ Object



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

def log(msg, level = :info)
  logger.send(level, msg)
end

.loggerObject



12
13
14
# File 'lib/opt_ar/logger.rb', line 12

def logger
  ActiveRecord::Base.logger || ::Logger.new(STDOUT)
end