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

More Subscribers? #58

Closed
hanshasselberg opened this issue Nov 19, 2013 · 4 comments
Closed

More Subscribers? #58

hanshasselberg opened this issue Nov 19, 2013 · 4 comments

Comments

@hanshasselberg
Copy link
Contributor

I wonder if you would accept a PR for another subscriber, generating the following format:

{
  "debug_info": {},
  "response": {
    "db": 0,
    "view": 0.19,
    "duration": 3.92,
    "status": 200
  },
  "request": {
    "path": "/api/ping",
    "params": {
      "x": "1"
    },
    "action": "ping",
    "controller": "ApiStateController",
    "format": "*/*",
    "headers": {
      "HTTP_ORIGIN": null,
      "HTTP_VERSION": "HTTP/1.1",
      "HTTP_ACCEPT": "*/*",
      "HTTP_HOST": "localhost:3000",
      "HTTP_USER_AGENT": "curl/7.30.0"
    },
    "ip": "127.0.0.1",
    "method": "GET"
  }
}
@roidrage
Copy link
Owner

Wouldn't that be another formatter instead? And maybe the option to utilize multiple formats?

@hanshasselberg
Copy link
Contributor Author

As far as I understand the formatter can only change the reprentation, not the structure of the log. The structure is created in RequestLogSubscriber. All the formatters only turn that stuff into a string.

@hanshasselberg
Copy link
Contributor Author

This is what I've come up with: https://gist.github.com/i0rek/7c142c25c24103f20dd9. Its not that different, but I wasn't able to squeeze it into the existing subscriber.

Edit: extract_request and process_action have changed.

@hanshasselberg
Copy link
Contributor Author

I've made a gem out of it. It is ugly right now, but this is how I want it to work for my stuff: https://github.com/i0rek/onelinejson.

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

2 participants