Class: TreasureData::Logger::Config
- Inherits:
-
Object
- Object
- TreasureData::Logger::Config
- Defined in:
- lib/td/logger.rb
Instance Attribute Summary collapse
-
#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
- #agent_mode? ⇒ Boolean
-
#initialize(conf) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(conf) ⇒ Config
Returns a new instance of Config.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/td/logger.rb', line 7 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 end |
Instance Attribute Details
#agent_host ⇒ Object (readonly)
Returns the value of attribute agent_host.
29 30 31 |
# File 'lib/td/logger.rb', line 29 def agent_host @agent_host end |
#agent_port ⇒ Object (readonly)
Returns the value of attribute agent_port.
29 30 31 |
# File 'lib/td/logger.rb', line 29 def agent_port @agent_port end |
#apikey ⇒ Object (readonly)
Returns the value of attribute apikey.
30 31 32 |
# File 'lib/td/logger.rb', line 30 def apikey @apikey end |
#auto_create_table ⇒ Object (readonly)
Returns the value of attribute auto_create_table.
30 31 32 |
# File 'lib/td/logger.rb', line 30 def auto_create_table @auto_create_table end |
#database ⇒ Object (readonly)
Returns the value of attribute database.
30 31 32 |
# File 'lib/td/logger.rb', line 30 def database @database end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
29 30 31 |
# File 'lib/td/logger.rb', line 29 def tag @tag end |
Instance Method Details
#agent_mode? ⇒ Boolean
32 33 34 |
# File 'lib/td/logger.rb', line 32 def agent_mode? @agent_host != nil end |