Module: Apjson
- Defined in:
- lib/apjson.rb
Class Method Summary collapse
Class Method Details
.default_logger ⇒ Object
21 22 23 24 25 26 |
# File 'lib/apjson.rb', line 21 def self.default_logger require 'logger' l = Logger.new(STDERR) l.level = Logger::INFO l end |
.logger ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/apjson.rb', line 6 def self.logger if @logger.nil? @logger = (rails_logger || default_logger) @logger.formatter = proc { |severity, datetime, progname, msg| datetime.strftime("[%Y-%m-%d %H:%M:%S](#{severity})#{msg}\n") } end return @logger end |
.logger=(logger) ⇒ Object
28 29 30 |
# File 'lib/apjson.rb', line 28 def self.logger=(logger) @logger = logger end |
.rails_logger ⇒ Object
16 17 18 19 |
# File 'lib/apjson.rb', line 16 def self.rails_logger (defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger) || (defined?(RAILS_DEFAULT_LOGGER) && RAILS_DEFAULT_LOGGER.respond_to?(:debug) && RAILS_DEFAULT_LOGGER) end |