Module: LogMe::ModelAdditions::ClassMethods
- Defined in:
- lib/log_me/model_additions.rb
Instance Method Summary collapse
Instance Method Details
#log(message, severity = :info) ⇒ Object
9 10 11 12 |
# File 'lib/log_me/model_additions.rb', line 9 def log(, severity = :info) @@log_me_log ||= Logger.new(@@log_me_file) @@log_me_log.send severity, "[#{Time.now.to_s(:db)}] [#{severity.to_s.capitalize}] #{}" end |
#log_me(name = nil) ⇒ Object
4 5 6 7 |
# File 'lib/log_me/model_additions.rb', line 4 def log_me(name = nil) name ||= self.model_name.underscore @@log_me_file = Rails.root.join('log', "#{name}.log").to_s end |