Class: SilverMother::Utils

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/silver_mother/utils.rb

Instance Method Summary collapse

Instance Method Details

#log_request(path, params, result) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/silver_mother/utils.rb', line 12

def log_request(path, params, result)
  log_message = <<-LOG_MESSAGE
    \n
    SENSE PATH: #{SENSE_API_URL}#{path}
    SENSE PARAMS: #{params.inspect}
    SENSE RESPONSE: #{result.success? && result.parsed_response.inspect}
  LOG_MESSAGE

  logger.debug(log_message) unless ENV['RACK_ENV'] == 'test'
end

#loggerObject



8
9
10
# File 'lib/silver_mother/utils.rb', line 8

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