Module: Argem

Includes:
TR::CondUtils
Defined in:
lib/argem.rb,
lib/argem/version.rb,
lib/argem/db_helper.rb

Defined Under Namespace

Classes: ApplicationRecord, DbHelper, Error

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.logger(tag = nil, &block) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/argem.rb', line 26

def self.logger(tag = nil, &block)
  if @_logger.nil?
    if ENV['ARGEM_LOG_TO_STDOUT'] == "true"
      @_logger = TeLogger::Tlogger.new
    else
      @_logger = TeLogger::Tlogger.new("argem.log",5, 5*1024*1024)
    end
  end

  if block
    if not_empty?(tag)
      @_logger.with_tag(tag, &block)
    else
      @_logger.with_tag(@_logger.tag, &block)
    end
  else
    if is_empty?(tag)
      @_logger.tag = :argem
      @_logger
    else
      # no block but tag is given? hmm
      @_logger.tag = tag
      @_logger
    end
  end

end

.logger=(logger) ⇒ Object

def self.env

ENV['ARGEM_ENV'] || "production"

end



22
23
24
# File 'lib/argem.rb', line 22

def self.logger=(logger)
  ActiveRecord::Base.logger = logger
end