Sha256: 7de7b982ac6b2a70baeb202076941540cec4c94bd8f990022333b248ee6b4d4d
Contents?: true
Size: 695 Bytes
Versions: 74
Compression:
Stored size: 695 Bytes
Contents
module LogHelpers def capture_logs(&block) log = std_stream use_logger_with(log, &block) log_contents(log) end def use_logger_with(log) Appsignal.logger = test_logger(log) yield Appsignal.logger = nil end def test_logger(log) Appsignal::Utils::IntegrationLogger.new(log).tap do |logger| logger.formatter = logger_formatter end end def logger_formatter proc do |severity, _datetime, _progname, msg| log_line(severity, msg) end end def log_line(severity, message) # This format is used in the `contains_log` matcher. "[#{severity}] #{message}\n" end def log_contents(log) log.rewind log.read end end
Version data entries
74 entries across 74 versions & 1 rubygems