Module: ModernTimes::Loggable
- Included in:
- ModernTimes
- Defined in:
- lib/modern_times/loggable.rb
Instance Method Summary collapse
Instance Method Details
#default_logger ⇒ Object
12 13 14 15 16 17 |
# File 'lib/modern_times/loggable.rb', line 12 def default_logger require 'logger' l = Logger.new($stdout) l.level = Logger::INFO l end |
#logger ⇒ Object
3 4 5 |
# File 'lib/modern_times/loggable.rb', line 3 def logger @logger ||= (rails_logger || default_logger) end |
#logger=(logger) ⇒ Object
19 20 21 |
# File 'lib/modern_times/loggable.rb', line 19 def logger=(logger) @logger = logger end |
#rails_logger ⇒ Object
7 8 9 10 |
# File 'lib/modern_times/loggable.rb', line 7 def rails_logger (defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger) || (defined?(RAILS_DEFAULT_LOGGER) && RAILS_DEFAULT_LOGGER.respond_to?(:debug) && RAILS_DEFAULT_LOGGER) end |