Class: OhMyLog::Log::Configuration
- Inherits:
-
Object
- Object
- OhMyLog::Log::Configuration
- Defined in:
- lib/oh_my_log/configuration.rb
Instance Attribute Summary collapse
-
#log_instance ⇒ Object
Returns the value of attribute log_instance.
-
#log_path ⇒ Object
Returns the value of attribute log_path.
-
#models ⇒ Object
Returns the value of attribute models.
-
#print_log ⇒ Object
Returns the value of attribute print_log.
-
#record_history ⇒ Object
Returns the value of attribute record_history.
-
#selectors ⇒ Object
readonly
Returns the value of attribute selectors.
Instance Method Summary collapse
- #add_selector(selector) ⇒ Object
- #get_actions(controller) ⇒ Object
-
#initialize(*args) ⇒ Configuration
constructor
A new instance of Configuration.
- #process_path ⇒ Object
- #reset_selectors ⇒ Object
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_instance ⇒ Object
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_path ⇒ Object
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 |
#models ⇒ Object
Returns the value of attribute models.
4 5 6 |
# File 'lib/oh_my_log/configuration.rb', line 4 def models @models end |
#print_log ⇒ Object
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_history ⇒ Object
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 |
#selectors ⇒ Object (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_path ⇒ Object
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_selectors ⇒ Object
22 23 24 |
# File 'lib/oh_my_log/configuration.rb', line 22 def reset_selectors @selectors = [] end |