Sha256: bc5e1b10056a30cdd8fde3baeace8917a2cbdcd0ef27172e925cb919d071a1cb

Contents?: true

Size: 574 Bytes

Versions: 5

Compression:

Stored size: 574 Bytes

Contents

require 'logger'
class UnitLogger

  def self.method_missing(meth, *args, &block)
    return Rails.logger.send(meth, *args, &block) if defined? Rails
    return unit.send(meth, *args, &block)
  end

  def self.unit
    return @logger unless @logger.nil?
    FileUtils::mkdir_p 'log' unless File.directory? 'log'
    File.open('log/test.log', 'w').close unless File.exist? 'log/test.log'
    @logger = Logger.new('log/test.log')
    @logger.formatter = proc do |severity, datetime, progname, msg|
      msg
    end
    @logger.level = Logger::DEBUG
    @logger
  end

end



Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_mocker-1.3.2 spec/unit_logger.rb
active_mocker-1.3.1 spec/unit_logger.rb
active_mocker-1.3 spec/unit_logger.rb
active_mocker-1.2.4 spec/unit_logger.rb
active_mocker-1.2.3 spec/unit_logger.rb