Class: Statter::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.
33 34 35 |
# File 'lib/statter.rb', line 33 def config @config end |
Class Method Details
.log(str) ⇒ Object
51 52 53 |
# File 'lib/statter.rb', line 51 def self.log(str) logger.info(str) if Config.instance.logging_on end |
.logger ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/statter.rb', line 35 def self.logger if defined? Rails log_path = "log/statter.#{Rails.env}.log" else log_path = "./statter.log" end @logger ||= Logger.new(log_path) end |
.with_config(config) ⇒ Object
45 46 47 48 49 |
# File 'lib/statter.rb', line 45 def self.with_config(config) i = instance i.config = config i end |
Instance Method Details
#log(str) ⇒ Object
55 56 57 |
# File 'lib/statter.rb', line 55 def log(str) self.class.log(str) end |
#send_data(type, name, data) ⇒ Object
59 60 61 62 |
# File 'lib/statter.rb', line 59 def send_data(type, name, data) log("enqueueing type: #{type}, name: #{name}, data: #{data}") ReporterJob.new.async.perform(config, type, name, data) end |