Sha256: e84aee2711b6523d567dde856f1475b2a4f821061975a951a989b6dd52cebaed

Contents?: true

Size: 836 Bytes

Versions: 4

Compression:

Stored size: 836 Bytes

Contents

require "rubygems"
require "bunny"

module Bunnish
  def self.parse_opts(argv)
    return Bunnish::Core::Common::parse_opts(argv)
  end
  
  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

  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

  def self.default_logger
    require 'logger'
    l = Logger.new(STDERR)
    l.level = Logger::INFO
    l
  end

  def self.logger=(logger)
    @logger = logger
  end
end

require "bunnish/command"
require "bunnish/core"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bunnish-0.1.1 lib/bunnish.rb
bunnish-0.1.0 lib/bunnish.rb
bunnish-0.0.9 lib/bunnish.rb
bunnish-0.0.8 lib/bunnish.rb