class Statsman::Agent
Attributes
config[RW]
Public Class Methods
log(str)
click to toggle source
# File lib/statsman.rb, line 54 def self.log(str) logger.info(str) if Config.instance.logging_on end
logger()
click to toggle source
# 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)
click to toggle source
# File lib/statsman.rb, line 48 def self.with_config(config) i = instance i.config = config i end
Public Instance Methods
log(str)
click to toggle source
# File lib/statsman.rb, line 58 def log(str) self.class.log(str) end
send_data(data_type, key, value, meta = {})
click to toggle source
# File lib/statsman.rb, line 62 def send_data(data_type, key, value, meta = {}) log("enqueueing data_type: #{data_type}, key: #{key}, value: #{value}, meta: #{meta.inspect}") Statsman::ReporterJob.new.async.perform(config, data_type, key, value, meta.to_json) end