class NetuitiveRailsAgent::NetuitiveLogger

Attributes

log[RW]

Public Class Methods

format_age(age) click to toggle source
# File lib/netuitive_rails_agent/netuitive_logger.rb, line 27
def format_age(age)
  return 'daily' if age.nil?
  begin
    Integer(age)
  rescue
    age
  end
end
format_size(size) click to toggle source
# File lib/netuitive_rails_agent/netuitive_logger.rb, line 36
def format_size(size)
  return 1_000_000 if size.nil?
  begin
    Integer(size)
  rescue
    size
  end
end
setup() click to toggle source
# File lib/netuitive_rails_agent/netuitive_logger.rb, line 14
def setup
  file = NetuitiveRailsAgent::ConfigManager.property('logLocation', 'NETUITIVE_RAILS_LOG_LOCATION', "#{File.expand_path('../../..', __FILE__)}/log/netuitive.log")
  age = NetuitiveRailsAgent::ConfigManager.property('logAge', 'NETUITIVE_RAILS_LOG_AGE', 'daily')
  age = format_age(age)
  size = NetuitiveRailsAgent::ConfigManager.property('logSize', 'NETUITIVE_RAILS_LOG_SIZE', '1000000')
  size = format_size(size)
  NetuitiveRailsAgent::NetuitiveLogger.log = Logger.new(file, age, size.to_i)
rescue => e
  puts 'netuitive unable to open log file'
  puts e.message
  NetuitiveRailsAgent::NetuitiveLogger.log = NetuitiveRailsAgent::CheaterLogger.new
end