Class: Insights::API::Common::Logging

Inherits:
Object
  • Object
show all
Defined in:
lib/insights/api/common/logging.rb

Class Method Summary collapse

Class Method Details

.activate(config, app_name = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/insights/api/common/logging.rb', line 13

def self.activate(config, app_name = nil)
  require 'insights/loggers'
  log_params = {}
  klass_for_logger = if Rails.env.production?
                       config.colorize_logging = false
                       log_params[:app_name] = app_name if app_name
                       logger_class
                     else
                       log_params = {:log_path => Rails.root.join("log", "#{Rails.env}.log")}
                       "ManageIQ::Loggers::Base"
                     end

  config.logger = Insights::Loggers::Factory.create_logger(klass_for_logger, log_params)
end

.logger_classObject



5
6
7
8
9
10
11
# File 'lib/insights/api/common/logging.rb', line 5

def self.logger_class
  if ENV['LOG_HANDLER'] == "haberdasher"
    "Insights::Loggers::StdErrorLogger"
  else
    "Insights::Loggers::CloudWatch"
  end
end