Class: OhMyLog::Log::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/oh_my_log/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Configuration

Returns a new instance of Configuration.



7
8
9
10
11
12
13
14
15
16
# File 'lib/oh_my_log/configuration.rb', line 7

def initialize(*args)
  @selectors = []
  #models not to track
  @models = {"ALL" => []}
  @print_log = true
  @log_instance = Logger.new(File.join(Rails.root, 'log/oh_my_log.log'))
  @log_path = nil
  #do we wanna keep track of all the actions?
  @record_history = false
end

Instance Attribute Details

#log_instanceObject

Returns the value of attribute log_instance.



4
5
6
# File 'lib/oh_my_log/configuration.rb', line 4

def log_instance
  @log_instance
end

#log_pathObject

Returns the value of attribute log_path.



4
5
6
# File 'lib/oh_my_log/configuration.rb', line 4

def log_path
  @log_path
end

#modelsObject

Returns the value of attribute models.



4
5
6
# File 'lib/oh_my_log/configuration.rb', line 4

def models
  @models
end

Returns the value of attribute print_log.



4
5
6
# File 'lib/oh_my_log/configuration.rb', line 4

def print_log
  @print_log
end

#record_historyObject

Returns the value of attribute record_history.



4
5
6
# File 'lib/oh_my_log/configuration.rb', line 4

def record_history
  @record_history
end

#selectorsObject (readonly)

Returns the value of attribute selectors.



5
6
7
# File 'lib/oh_my_log/configuration.rb', line 5

def selectors
  @selectors
end

Instance Method Details

#add_selector(selector) ⇒ Object



18
19
20
# File 'lib/oh_my_log/configuration.rb', line 18

def add_selector(selector)
  @selectors << selector
end

#get_actions(controller) ⇒ Object



26
27
28
29
30
# File 'lib/oh_my_log/configuration.rb', line 26

def get_actions(controller)
  @selectors.each do |selector|
    return selector.actions if selector.controller == controller
  end
end

#process_pathObject



32
33
34
# File 'lib/oh_my_log/configuration.rb', line 32

def process_path
  @log_instance = Logger.new(@log_path) if (@log_path)
end

#reset_selectorsObject



22
23
24
# File 'lib/oh_my_log/configuration.rb', line 22

def reset_selectors
  @selectors = []
end