Skip to content

Commit 3c002fa

Browse files
committed
Remove debug or make it not interfere with mutant.
1 parent 29f88d3 commit 3c002fa

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

infra/lib/infra/event_store.rb

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ module Infra
22
class EventStore < SimpleDelegator
33
def self.main
44
if ENV['DISABLE_EVENT_TRANSFORMATIONS'] == 'true'
5-
puts "[DEBUG] Event transformations DISABLED"
65
mapper = debug_mapper
76
else
8-
puts "[DEBUG] Event transformations ENABLED"
97
require_relative "../../../rails_application/lib/transformations/refund_to_return_event_mapper" rescue nil
108

119
if defined?(Transformations::RefundToReturnEventMapper)
@@ -31,10 +29,10 @@ def self.main
3129
def client.publish(*events, **kwargs)
3230
events.each do |event|
3331
if event.respond_to?(:timestamp) && event.timestamp.nil?
34-
puts "[ERROR] Event #{event.class.name} has nil timestamp!"
35-
puts "[ERROR] Event ID: #{event.event_id}"
36-
puts "[ERROR] Stack trace:"
37-
puts caller[0..10].join("\n")
32+
$stderr.puts "[ERROR] Event #{event.class.name} has nil timestamp!"
33+
$stderr.puts "[ERROR] Event ID: #{event.event_id}"
34+
$stderr.puts "[ERROR] Stack trace:"
35+
$stderr.puts caller[0..10].join("\n")
3836
end
3937
end
4038
super(*events, **kwargs)
@@ -80,16 +78,14 @@ class << default_mapper_instance
8078
alias_method :original_event_to_record, :event_to_record
8179

8280
def event_to_record(domain_event)
83-
puts "[DEBUG] Before transformation - Event timestamp: #{domain_event.timestamp}"
8481
record = original_event_to_record(domain_event)
85-
puts "[DEBUG] After transformation - Record timestamp: #{record.timestamp}"
8682
if record.timestamp.nil?
87-
puts "[ERROR] Record created with nil timestamp!"
88-
puts "[ERROR] Event class: #{domain_event.class.name}"
89-
puts "[ERROR] Event ID: #{domain_event.event_id}"
90-
puts "[ERROR] Domain event timestamp: #{domain_event.respond_to?(:timestamp) ? domain_event.timestamp : 'N/A'}"
91-
puts "[ERROR] Stack trace:"
92-
puts caller[0..15].join("\n")
83+
$stderr.puts "[ERROR] Record created with nil timestamp!"
84+
$stderr.puts "[ERROR] Event class: #{domain_event.class.name}"
85+
$stderr.puts "[ERROR] Event ID: #{domain_event.event_id}"
86+
$stderr.puts "[ERROR] Domain event timestamp: #{domain_event.respond_to?(:timestamp) ? domain_event.timestamp : 'N/A'}"
87+
$stderr.puts "[ERROR] Stack trace:"
88+
$stderr.puts caller[0..15].join("\n")
9389
end
9490
record
9591
end

0 commit comments

Comments
 (0)