Module: TreasureData::Logger::Agent::Rails
- Defined in:
- lib/td/logger/agent/rails.rb,
lib/td/logger/agent/rails/model.rb,
lib/td/logger/agent/rails/config.rb,
lib/td/logger/agent/rails/controller.rb
Defined Under Namespace
Modules: ControllerExtension, ModelExtension Classes: Config, Railtie
Constant Summary collapse
- CONFIG_PATH =
ENV['TREASURE_DATA_YML'] || 'config/treasure_data.yml'
- CONFIG_PATH_EY_LOCAL =
"#{::Rails.root}/config/ey_services_config_local.yml"
- CONFIG_PATH_EY_DEPLOY =
"#{::Rails.root}/config/ey_services_config_deploy.yml"
Class Method Summary collapse
-
.init(rails) ⇒ Object
require ‘td/logger/agent/rails/model’.
Class Method Details
.init(rails) ⇒ Object
require ‘td/logger/agent/rails/model’
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/td/logger/agent/rails.rb', line 14 def self.init(rails) c = Config.init if c.disabled warn 'Disabling Treasure Data event logger.' ::TreasureData::Logger.open_null return false end if c.test_mode? ::TreasureData::Logger.open_test elsif c.agent_mode? ::TreasureData::Logger.open_agent(c.tag, :host=>c.agent_host, :port=>c.agent_port, :debug=>c.debug_mode) else ::TreasureData::Logger.open(c.database, :apikey=>c.apikey, :auto_create_table=>c.auto_create_table, :debug=>c.debug_mode) end rails.middleware.use Agent::Rack::Hook Agent::Rack::Hook.before do |env| TreasureData::Logger.event.attribute.clear end Agent::Rails::ControllerExtension.init #Agent::Rails::AccessLogger.init(c.access_log_table) if c.access_log_enabled? #Agent::Rails::ModelExtension.init true end |