Sha256: 1479899d51e60fb573df64c62392952f0f4dbf13275a03375b712a53c9f15514

Contents?: true

Size: 454 Bytes

Versions: 67

Compression:

Stored size: 454 Bytes

Contents

module LogHelpers
  def use_logger_with(log)
    Appsignal.logger = test_logger(log)
    yield
    Appsignal.logger = nil
  end

  def test_logger(log)
    Logger.new(log).tap do |logger|
      logger.formatter =
        proc do |severity, _datetime, _progname, msg|
          # This format is used in the `contains_log` matcher.
          "[#{severity}] #{msg}\n"
        end
    end
  end

  def log_contents(log)
    log.rewind
    log.read
  end
end

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
appsignal-2.8.4 spec/support/helpers/log_helpers.rb
appsignal-2.8.4-java spec/support/helpers/log_helpers.rb
appsignal-2.8.4.beta.1 spec/support/helpers/log_helpers.rb
appsignal-2.8.4.beta.1-java spec/support/helpers/log_helpers.rb
appsignal-2.8.3 spec/support/helpers/log_helpers.rb
appsignal-2.8.3-java spec/support/helpers/log_helpers.rb
appsignal-2.8.3.beta.1 spec/support/helpers/log_helpers.rb
appsignal-2.8.3.beta.1-java spec/support/helpers/log_helpers.rb
appsignal-2.8.2 spec/support/helpers/log_helpers.rb
appsignal-2.8.2-java spec/support/helpers/log_helpers.rb
appsignal-2.8.1 spec/support/helpers/log_helpers.rb
appsignal-2.8.1-java spec/support/helpers/log_helpers.rb
appsignal-2.8.1.alpha.1-java spec/support/helpers/log_helpers.rb
appsignal-2.8.1.alpha.1 spec/support/helpers/log_helpers.rb
appsignal-2.8.0 spec/support/helpers/log_helpers.rb
appsignal-2.8.0-java spec/support/helpers/log_helpers.rb
appsignal-2.7.3.beta.2-java spec/support/helpers/log_helpers.rb
appsignal-2.7.3.beta.2 spec/support/helpers/log_helpers.rb
appsignal-2.7.3.beta.1 spec/support/helpers/log_helpers.rb
appsignal-2.7.3.beta.1-java spec/support/helpers/log_helpers.rb