Sha256: c397021b7f8a7c236c9fd081bde812dcb55415960d7caefba52ea46b9f204b42

Contents?: true

Size: 645 Bytes

Versions: 56

Compression:

Stored size: 645 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, &block)
          if message
            self.message = message
          elsif block
            self.message = block.call
          else
            self.message = progname
          end
          self.message
        end

        def #{level}?
          @true
        end
    EOT
  end

  def flush
    true
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
semantic_logger-2.4.1 test/mock_logger.rb
semantic_logger-2.4.0 test/mock_logger.rb
semantic_logger-2.3.1 test/mock_logger.rb
semantic_logger-2.3.0 test/mock_logger.rb
semantic_logger-2.2.0 test/mock_logger.rb
semantic_logger-2.1.0 test/mock_logger.rb
semantic_logger-2.0.0 test/mock_logger.rb
semantic_logger-1.0.1 test/mock_logger.rb
semantic_logger-1.0.0 test/mock_logger.rb
semantic_logger-0.11.4 test/mock_logger.rb
semantic_logger-0.11.3 test/mock_logger.rb
semantic_logger-0.11.2 test/mock_logger.rb
semantic_logger-0.11.1 test/mock_logger.rb
semantic_logger-0.11.0 test/mock_logger.rb
semantic_logger-0.10.0 test/mock_logger.rb
semantic_logger-0.9.0 test/mock_logger.rb
semantic_logger-0.8.1 test/mock_logger.rb
semantic_logger-0.8.0 test/mock_logger.rb
semantic_logger-0.7.1 test/mock_logger.rb
semantic_logger-0.7.0 test/mock_logger.rb