Module: ActionController::OutputLogging
- Defined in:
- lib/vex/action_controller/output_logging.rb
Class Method Summary collapse
- .do_output_logging(controller, exception) ⇒ Object
- .filter(controller, &block) ⇒ Object
- .logger ⇒ Object
Instance Method Summary collapse
Class Method Details
.do_output_logging(controller, exception) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/vex/action_controller/output_logging.rb', line 13 def self.do_output_logging(controller, exception) msg = [] msg << "#{Time.now}: #{controller.request.query_string}" msg << (controller.params.to_a.sort_by(&:first).map { |k,v| " #{k}: #{v.inspect}"}).join("\n") msg << "Caught exception #{exception.inspect}" if exception msg << controller.response.body msg = msg.join("\n" + "-" * 80 + "\n") + "\n" + "=" * 80 logger.warn msg end |
.filter(controller, &block) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/vex/action_controller/output_logging.rb', line 6 def self.filter(controller, &block) yield do_output_logging controller, nil rescue do_output_logging controller, $! end |
.logger ⇒ Object
25 26 27 |
# File 'lib/vex/action_controller/output_logging.rb', line 25 def self.logger @logger ||= ActiveSupport::BufferedLogger.new "#{RAILS_ROOT}/log/output.log" end |
Instance Method Details
#with_output_logging ⇒ Object
2 3 4 |
# File 'lib/vex/action_controller/output_logging.rb', line 2 def with_output_logging around_filter ActionController::OutputLogging end |