lib/timber/events/controller_call.rb in timber-2.1.1 vs lib/timber/events/controller_call.rb in timber-2.1.2
- old
+ new
@@ -8,10 +8,11 @@
# Processing by PagesController#home as HTML
#
# @note This event should be installed automatically through integrations,
# such as the {Integrations::ActionController::LogSubscriber} integration.
class ControllerCall < Timber::Event
+ PARAMS_JSON_MAX_BYTES = 8192.freeze
PASSWORD_NAME = 'password'.freeze
attr_reader :controller, :action, :params, :format
def initialize(attributes)
@@ -42,14 +43,15 @@
message
end
private
def params_json
- @params_json ||= if params.nil? || params == {}
- nil
- else
- params.to_json
- end
+ @params_json ||=
+ if params.nil? || params == {}
+ nil
+ else
+ params.to_json.byteslice(0, PARAMS_JSON_MAX_BYTES)
+ end
end
def sanitize_params(params)
if params.is_a?(::Hash)
Util::Hash.sanitize(params, [PASSWORD_NAME])
\ No newline at end of file