Class: QuickLogger
- Inherits:
-
Object
- Object
- QuickLogger
- Defined in:
- lib/rails2ext/active_support/quick_logger.rb
Overview
quick and dirty logger: just inherit from here, set the filename attribute then you’re ready to go
Direct Known Subclasses
Class Attribute Summary collapse
-
.filename ⇒ Object
Returns the value of attribute filename.
Class Method Summary collapse
Class Attribute Details
.filename ⇒ Object
Returns the value of attribute filename.
7 8 9 |
# File 'lib/rails2ext/active_support/quick_logger.rb', line 7 def filename @filename end |
Class Method Details
.filename_path ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/rails2ext/active_support/quick_logger.rb', line 9 def filename_path if defined?(Rails) File.join Rails.root, 'log', [@filename, Rails.env, 'log'].join('.') else [@filename, 'log'].join('.') end end |
.method_missing(log_level, message) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/rails2ext/active_support/quick_logger.rb', line 17 def method_missing(log_level, ) @logger ||= ::Logger.new(filename_path) if ::Logger::SEV_LABEL.include?(log_level.to_s.upcase) @logger.send log_level, "[#{Time.now}] #{}" else super end end |