Class: Statsman::Agent
Overview
Config
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
36 37 38 |
# File 'lib/statsman.rb', line 36 def config @config end |
Class Method Details
.log(str) ⇒ Object
54 55 56 |
# File 'lib/statsman.rb', line 54 def self.log(str) logger.info(str) if Config.instance.logging_on end |
.logger ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/statsman.rb', line 38 def self.logger if defined? Rails log_path = "log/statsman.#{Rails.env}.log" else log_path = "./statsman.log" end @logger ||= Logger.new(log_path) end |
.with_config(config) ⇒ Object
48 49 50 51 52 |
# File 'lib/statsman.rb', line 48 def self.with_config(config) i = instance i.config = config i end |
Instance Method Details
#log(str) ⇒ Object
58 59 60 |
# File 'lib/statsman.rb', line 58 def log(str) self.class.log(str) end |
#send_data(data_type, key, value, meta = {}) ⇒ Object
62 63 64 65 |
# File 'lib/statsman.rb', line 62 def send_data(data_type, key, value, = {}) log("enqueueing data_type: #{data_type}, key: #{key}, value: #{value}, meta: #{.inspect}") Statsman::ReporterJob.new.async.perform(config, data_type, key, value, .to_json) end |