Skip to content

Logging #5

Open
Open

Description

@TwP

We need to add some logging to the Client class. For each request the client makes, we should output a detailed debug message to a logger of some sort. I really like how Tire does it; logging a curl command that you can copy/paste and use directly. Also, outputting the status code of the response would be good, too ...

[200] curl -XGET 'http://localhost:9200/index/_search' -d '...'

Not sure how to handle large bodies and what not. And I don't think we need to log responses.

cc @github/search

Activity

  1. wfarr commented on Apr 20, 2013

    @wfarr

    IMO, http requests with bodies should be a level of logging but likely not the default.

    As far as logging request bodies goes, strip new lines and compress multiple spaces into a single space.

    On Sat, Apr 20, 2013 at 6:20 PM, Tim Pease notifications@github.com
    wrote:

    We need to add some logging to the Client class. For each request the client makes, we should output a detailed debug message to a logger of some sort. I really like how Tire does it; logging a curl command that you can copy/paste and use directly. Also, outputting the status code of the response would be good, too ...

    [200] curl -XGET 'http://localhost:9200/index/_search' -d '...'
    

    Not sure how to handle large bodies and what not. And I don't think we need to log responses.

    cc @github/search

    Reply to this email directly or view it on GitHub:
    #5

  2. grantr commented on Apr 22, 2013

    @grantr
    Contributor

    Maybe the client can take a :verbose level or :trace => true option that increases the logging level to include requests and responses?

  3. grantr commented on Apr 22, 2013

    @grantr
    Contributor

    We can't require activesupport for the low level client, but at a higher level we should use ActiveSupport::Notifications and a LogSubscriber.

  4. wfarr commented on Apr 22, 2013

    @wfarr

    I'd much prefer to keep it in UNIX convention and offer info, error, debug, etc log levels.

    On Mon, Apr 22, 2013 at 11:05 AM, Grant Rodgers notifications@github.com
    wrote:

    Maybe the client can take a :verbose level or :trace => true option that increases the logging level to include requests and responses?

    Reply to this email directly or view it on GitHub:
    #5 (comment)

  5. grantr commented on Aug 27, 2013

    @grantr
    Contributor

    Picking this back up.

    @TwP do you like the way tire has a module-level logger instance? Should we add Elastomer.logger? Since you are well versed in all things logging I figure you'll probably know best how to add lightweight logging to a library.

  6. TwP commented on Aug 28, 2013

    @TwP
    ContributorAuthor

    Given ∞ time, I would much rather use https://github.com/TwP/polylog

    The idea behind polylog is that each library requests a logging instance from Polylog, and the application then configures Polylog to hand out the type of logger that it wants to use. So you only need to configure a logger in one location. Every library then grabs that logger and uses it.

    This is akin to SLF4J, but with a much more pronounceable name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions