Sha256: b5893ae33c481b249920cf5c53f41deddade22a5f383e282721add5b23b23936
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
module Timber module Contexts module HTTPRequests # Extend Context since we are a sub context and not an actual HTTPRequest class ActionControllerSpecific < Context ROOT_KEY = :action_controller.freeze VERSION = 1.freeze class << self def json_shell(&_block) Rack.json_shell { super } end end attr_reader :controller_obj def initialize(controller_obj) # Initialize should be as fast as possible since it is executed inline. # Hence the lazy methods below. @controller_obj = controller_obj super() end def action @action ||= controller_obj.action_name end def controller @controller ||= controller_obj.class.name end def format @format ||= controller_obj.request.format.try(:ref) end private def json_payload @json_payload ||= Macros::DeepMerger.merge({ # order is relevant for logfmt styling :controller => controller, :action => action, :format => format }, super).freeze end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
timberio-1.0.0.beta1 | lib/timber/contexts/http_requests/action_controller_specific.rb |