Sha256: 6ba8ad14c13f2c7b01217a90d8c742489df76f1013a67739143412106b9b35d0

Contents?: true

Size: 627 Bytes

Versions: 33

Compression:

Stored size: 627 Bytes

Contents

module Dbox
  module Loggable
    def self.included receiver
      receiver.extend ClassMethods
    end

    module ClassMethods
      def log
        Dbox.log
      end
    end

    def log
      Dbox.log
    end
  end

  def self.log
    @logger ||= setup_logger
  end

  def self.setup_logger
    if defined?(LOGGER)
      LOGGER
    elsif defined?(Rails.logger)
      Rails.logger
    else
      l = Logger.new(STDOUT)
      l.level = (ENV["DEBUG"] && ENV["DEBUG"] != "false") ? Logger::DEBUG : Logger::INFO
      l.formatter = proc {|severity, datetime, progname, msg| "[#{severity}] #{msg}\n" }
      l
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
dbox-0.8.3 lib/dbox/loggable.rb
dbox-0.8.2 lib/dbox/loggable.rb
dbox-0.8.1 lib/dbox/loggable.rb
dbox-0.8.0 lib/dbox/loggable.rb
dbox-0.7.6 lib/dbox/loggable.rb
dbox-0.7.5 lib/dbox/loggable.rb
dbox-0.7.4 lib/dbox/loggable.rb
dbox-0.7.3 lib/dbox/loggable.rb
dbox-0.7.2 lib/dbox/loggable.rb
dbox-0.7.1 lib/dbox/loggable.rb
dbox-0.7.0 lib/dbox/loggable.rb
dbox-0.6.15 lib/dbox/loggable.rb
dbox-0.6.14 lib/dbox/loggable.rb
dbox-0.6.13 lib/dbox/loggable.rb
dbox-0.6.12 lib/dbox/loggable.rb
dbox-0.6.11 lib/dbox/loggable.rb
dbox-0.6.10 lib/dbox/loggable.rb
dbox-0.6.9 lib/dbox/loggable.rb
dbox-0.6.8 lib/dbox/loggable.rb
dbox-0.6.7 lib/dbox/loggable.rb