Module: Priam

Defined in:
lib/priam.rb

Defined Under Namespace

Modules: Command, Core

Class Method Summary collapse

Class Method Details

.default_loggerObject



24
25
26
27
28
29
# File 'lib/priam.rb', line 24

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

.get_column(client, column_family, super_column, key, options = {}) ⇒ Object



5
6
7
# File 'lib/priam.rb', line 5

def self.get_column(client, column_family, super_column, key, options={})
  return Priam::Core::Get.get_column(client, column_family, super_column, key, options)
end

.loggerObject



9
10
11
12
13
14
15
16
17
# File 'lib/priam.rb', line 9

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



31
32
33
# File 'lib/priam.rb', line 31

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

.rails_loggerObject



19
20
21
22
# File 'lib/priam.rb', line 19

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