Sha256: 19d67e5cf8c539ac45319a766956c6dbc394435ac3fff05522721bc2a351bde4

Contents?: true

Size: 639 Bytes

Versions: 15

Compression:

Stored size: 639 Bytes

Contents

# Looks like a standard Ruby Logger or Rails Logger
# Except that it stores the last logged entry in the instance variable: message
class MockLogger
  attr_accessor :message

  Logger::Severity.constants.each do |level|
    class_eval <<-EOT, __FILE__, __LINE__
        def #{level.downcase}(message = nil, progname = nil)
          if message
            self.message = message
          elsif block_given?
            self.message = yield
          else
            self.message = progname
          end
          self.message
        end

        def #{level}?
          @true
        end
    EOT
  end

  def flush
    true
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
semantic_logger-4.1.1 test/mock_logger.rb
semantic_logger-4.1.0 test/mock_logger.rb
semantic_logger-4.0.0 test/mock_logger.rb
semantic_logger-4.0.0.rc1 test/mock_logger.rb
semantic_logger-4.0.0.beta2 test/mock_logger.rb
semantic_logger-4.0.0.beta1 test/mock_logger.rb
semantic_logger-3.4.1 test/mock_logger.rb
semantic_logger-3.4.0 test/mock_logger.rb
semantic_logger-3.3.0 test/mock_logger.rb
semantic_logger-3.2.1 test/mock_logger.rb
semantic_logger-3.2.0 test/mock_logger.rb
semantic_logger-3.1.0 test/mock_logger.rb
semantic_logger-3.0.1 test/mock_logger.rb
semantic_logger-3.0.0 test/mock_logger.rb
semantic_logger-2.21.0 test/mock_logger.rb