Class: TreasureData::Logger::Agent::Rails::Config
- Inherits:
-
Object
- Object
- TreasureData::Logger::Agent::Rails::Config
- Defined in:
- lib/td/logger/agent/rails.rb
Instance Attribute Summary collapse
-
#access_log_table ⇒ Object
readonly
Returns the value of attribute access_log_table.
-
#agent_host ⇒ Object
readonly
Returns the value of attribute agent_host.
-
#agent_port ⇒ Object
readonly
Returns the value of attribute agent_port.
-
#apikey ⇒ Object
readonly
Returns the value of attribute apikey.
-
#auto_create_table ⇒ Object
readonly
Returns the value of attribute auto_create_table.
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
- #access_log_enabled? ⇒ Boolean
- #agent_mode? ⇒ Boolean
-
#initialize(conf) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(conf) ⇒ Config
Returns a new instance of Config.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/td/logger/agent/rails.rb', line 48 def initialize(conf) if agent = conf['agent'] host, port = agent.split(':',2) port = (port || 24224).to_i @agent_host = host @agent_port = port @tag = conf['tag'] @tag ||= conf['database'] raise "'tag' nor 'database' options are not set" unless @tag else @apikey = conf['apikey'] raise "'apikey' option is not set" unless @apikey @database = conf['database'] raise "'database' option is not set" unless @database @auto_create_table = !!conf['auto_create_table'] end @access_log_table = conf['access_log_table'] end |
Instance Attribute Details
#access_log_table ⇒ Object (readonly)
Returns the value of attribute access_log_table.
74 75 76 |
# File 'lib/td/logger/agent/rails.rb', line 74 def access_log_table @access_log_table end |
#agent_host ⇒ Object (readonly)
Returns the value of attribute agent_host.
72 73 74 |
# File 'lib/td/logger/agent/rails.rb', line 72 def agent_host @agent_host end |
#agent_port ⇒ Object (readonly)
Returns the value of attribute agent_port.
72 73 74 |
# File 'lib/td/logger/agent/rails.rb', line 72 def agent_port @agent_port end |
#apikey ⇒ Object (readonly)
Returns the value of attribute apikey.
73 74 75 |
# File 'lib/td/logger/agent/rails.rb', line 73 def apikey @apikey end |
#auto_create_table ⇒ Object (readonly)
Returns the value of attribute auto_create_table.
73 74 75 |
# File 'lib/td/logger/agent/rails.rb', line 73 def auto_create_table @auto_create_table end |
#database ⇒ Object (readonly)
Returns the value of attribute database.
73 74 75 |
# File 'lib/td/logger/agent/rails.rb', line 73 def database @database end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
72 73 74 |
# File 'lib/td/logger/agent/rails.rb', line 72 def tag @tag end |
Instance Method Details
#access_log_enabled? ⇒ Boolean
80 81 82 |
# File 'lib/td/logger/agent/rails.rb', line 80 def access_log_enabled? !@access_log_table.nil? && !@access_log_table.empty? end |
#agent_mode? ⇒ Boolean
76 77 78 |
# File 'lib/td/logger/agent/rails.rb', line 76 def agent_mode? @agent_host != nil end |