Module: LogMe::ControllerAdditions::ClassMethods

Defined in:
lib/log_me/controller_additions.rb

Instance Method Summary collapse

Instance Method Details

#log(message, severity = :info) ⇒ Object



9
10
11
12
# File 'lib/log_me/controller_additions.rb', line 9

def log(message, severity = :info)
  @@log_me_log ||= Logger.new(@@log_me_file)
  @@log_me_log.send severity, "[#{Time.now.to_s(:db)}] [#{severity.to_s.capitalize}] #{message}"
end

#log_me(name = nil) ⇒ Object



4
5
6
7
# File 'lib/log_me/controller_additions.rb', line 4

def log_me(name = nil)
  name ||= self.controller_name.underscore
  @@log_me_file = Rails.root.join('log', "#{name}.log").to_s
end