Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging after action has been processed. #144

Open
braindeaf opened this issue Dec 6, 2017 · 0 comments
Open

Logging after action has been processed. #144

braindeaf opened this issue Dec 6, 2017 · 0 comments

Comments

@braindeaf
Copy link

It would appear according to lib/logstasher/rails_ext/action_controller/metal/instrumentation.rb
That the two locations where the payload is appended to occur before the action is processed. Can you clarify how they then differ from one another.

The downside to this is that something that occurs within the action cannot be appended to the log, e.g. logging a user in, or the changed state of an order, etc. Shouldn't :logstasher_add_custom_fields_to_payload be after the process_action?

` if self.respond_to?(:logstasher_add_custom_fields_to_request_context)
logstasher_add_custom_fields_to_request_context(LogStasher.request_context)
end

    if self.respond_to?(:logstasher_add_custom_fields_to_payload)
      before_keys = raw_payload.keys.clone
      logstasher_add_custom_fields_to_payload(raw_payload)
      after_keys = raw_payload.keys
      # Store all extra keys added to payload hash in payload itself. This is a thread safe way
      LogStasher::CustomFields.add(*(after_keys - before_keys))
    end

    result = super

`

Also the method call 'append_info_to_payload(payload)' after the request has been processed seems to duplicate the same logic which is confusing.

Can you clarify?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant