class Statter::Agent

Attributes

config[RW]

Public Class Methods

log(str) click to toggle source
# File lib/statter.rb, line 51
def self.log(str)
  logger.info(str) if Config.instance.logging_on
end
logger() click to toggle source
# 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) click to toggle source
# File lib/statter.rb, line 45
def self.with_config(config)
  i = instance
  i.config = config
  i
end

Public Instance Methods

log(str) click to toggle source
# File lib/statter.rb, line 55
def log(str)
  self.class.log(str)
end
send_data(type, name, data) click to toggle source
# 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