Class: RailsSemanticLogging::RSpec::InMemoryAppender

Inherits:
SemanticLogger::Subscriber
  • Object
show all
Defined in:
lib/rails_semantic_logging/rspec/matchers.rb

Overview

In-memory appender that collects log entries for assertion

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInMemoryAppender

Returns a new instance of InMemoryAppender.



9
10
11
12
# File 'lib/rails_semantic_logging/rspec/matchers.rb', line 9

def initialize
  super(level: :trace)
  @logs = []
end

Instance Attribute Details

#logsObject (readonly)

Returns the value of attribute logs.



7
8
9
# File 'lib/rails_semantic_logging/rspec/matchers.rb', line 7

def logs
  @logs
end

Instance Method Details

#flushObject



18
19
20
# File 'lib/rails_semantic_logging/rspec/matchers.rb', line 18

def flush
  # No-op for in-memory
end

#log(log_entry) ⇒ Object



14
15
16
# File 'lib/rails_semantic_logging/rspec/matchers.rb', line 14

def log(log_entry)
  @logs << log_entry
end