Module: Trifle::Logger::Middleware::RailsController::InstanceMethods
- Defined in:
- lib/trifle/logger/middleware/rails_controller.rb
Instance Method Summary collapse
Instance Method Details
#trace_key ⇒ Object
32 33 34 |
# File 'lib/trifle/logger/middleware/rails_controller.rb', line 32 def trace_key "#{params[:controller]}/#{params[:action]}" end |
#trace_meta ⇒ Object
36 37 38 |
# File 'lib/trifle/logger/middleware/rails_controller.rb', line 36 def [params[:id]].compact end |
#with_trifle_logger ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/trifle/logger/middleware/rails_controller.rb', line 19 def with_trifle_logger Trifle::Logger.tracer = Trifle::Logger.default.tracer_class.new( key: trace_key, meta: ) yield rescue => e # rubocop:disable Style/RescueStandardError Trifle::Logger.tracer.trace("Exception: #{e}", state: :error) Trifle::Logger.tracer.fail! raise e ensure Trifle::Logger.tracer.wrapup end |