Sha256: 5392530c5f74d9b6bf79ef4724012aa662a0d09167dfca3b9292ce28fddfb006

Contents?: true

Size: 617 Bytes

Versions: 1

Compression:

Stored size: 617 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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
semantic_logger-0.0.2 test/mock_logger.rb