Class: Julewire::Rails::StructuredEventRecord
- Inherits:
-
Object
- Object
- Julewire::Rails::StructuredEventRecord
- Defined in:
- lib/julewire/rails/structured_event_record.rb
Constant Summary collapse
- DEBUG_EVENT_PREFIXES =
%w[ action_view. active_record. ].freeze
- DEBUG_EVENTS =
%w[ action_controller.unpermitted_parameters ].freeze
Instance Method Summary collapse
- #call(event, name:, payload:) ⇒ Object
-
#initialize(configuration, parameter_filter: Julewire::Core::UNSET) ⇒ StructuredEventRecord
constructor
A new instance of StructuredEventRecord.
- #payload_hash(payload) ⇒ Object
Constructor Details
#initialize(configuration, parameter_filter: Julewire::Core::UNSET) ⇒ StructuredEventRecord
Returns a new instance of StructuredEventRecord.
16 17 18 19 20 21 22 23 |
# File 'lib/julewire/rails/structured_event_record.rb', line 16 def initialize(configuration, parameter_filter: Julewire::Core::UNSET) @configuration = configuration @parameter_filter = if parameter_filter.equal?(Julewire::Core::UNSET) ParameterFilters.build(ParameterFilters.configured) else parameter_filter end end |
Instance Method Details
#call(event, name:, payload:) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/julewire/rails/structured_event_record.rb', line 25 def call(event, name:, payload:) values = Julewire::Core::Integration::Values::Shape { timestamp: values.(event[:timestamp]), severity: severity_for(name), event: name, logger: "Rails.event", source: @configuration.source, context: values.hash_or_empty(event[:context]), attributes: attributes_for(event, payload), neutral: neutral_for(event) }.compact end |
#payload_hash(payload) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/julewire/rails/structured_event_record.rb', line 39 def payload_hash(payload) case payload when nil {} when Hash values = Julewire::Core::Integration::Values::Shape values.payload_hash(payload) else serialize_payload_object(payload) end end |