Enable logging by default?

21 views
Skip to first unread message

Alan Savage

unread,
Sep 11, 2020, 3:18:04 PM9/11/20
to http.rb: a fast, easy-to-use Ruby HTTP client with a chainable API
Is there a way to enable logging for all requests by default? Maybe by setting default_options? It's unclear to me how to enable a particular feature by default with options.

Tony Arcieri

unread,
Sep 11, 2020, 3:20:25 PM9/11/20
to Alan Savage, http.rb: a fast, easy-to-use Ruby HTTP client with a chainable API

On Fri, Sep 11, 2020 at 12:18 PM Alan Savage <al...@piesystems.io> wrote:
Is there a way to enable logging for all requests by default? Maybe by setting default_options? It's unclear to me how to enable a particular feature by default with options.

--
You received this message because you are subscribed to the Google Groups "http.rb: a fast, easy-to-use Ruby HTTP client with a chainable API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to httprb+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/httprb/b367c260-5c9a-488e-a959-bef2d315c391n%40googlegroups.com.


--
Tony Arcieri

Alan Savage

unread,
Sep 11, 2020, 3:40:02 PM9/11/20
to http.rb: a fast, easy-to-use Ruby HTTP client with a chainable API
Figured it out:
```
HTTP.default_options = HTTP::Options.new(
  features: {
    logging: {
      logger: Rails.logger
    }
  }
)
```

I'll add it to the Wiki (with a non-rails logger example)

Reply all
Reply to author
Forward
0 new messages