Timber v2.5.2 Timber.Integrations.ExAwsHTTPClient View Source

ExAWS is an excellent library for interfacing with the AWS API. The Timber ExAWSHTTPClient adds structured logging to the HTTP requests being sent to the AWS API. This gives you valuable insight into AWS communication from your application. We use is internally at Timber.

By default, this library will only log destructive requests (POST, PUT, DELETE, and PATCH). GET requests can be turned via configuration (see below).

Installation

config :ex_aws,
  http_client: Timber.Integrations.ExAwsHTTPClient

Configuration

config :timber, Timber.Integrations.ExAWSHTTPClient,
  http_methods_to_log: [:post, :put, :delete, :patch],
  capture_bodies: false
  • http_methods_to_log - (default: [:post, :put, :delete, :patch]). Only log requests whose method is included in the list. Use :all to log all methods.
  • capture_bodies - (default: false). When enabled, The first 2048 characters of the body will be included in the metadata of the log. It is recommended to enable this for debug purposes only as it can get excessive. You can also lower the size via config :timber, :http_body_size_limit, 2048.

Only log specific services

ExAws offers the ability to configure on a per service basis:

config :ex_aws, :lambda,
  http_client: Timber.Integrations.ExAwsHTTPClient

Alternatively you can exclude services in the same way:

config :ex_aws,
  http_client: Timber.Integrations.ExAwsHTTPClient

# Fallback to the defualt, non-logging HTTP client
config :ex_aws, :lambda,
  http_client: ExAws.Request.Hackney

Link to this section Summary

Link to this section Functions

Link to this function request(method, url, body \\ "", headers \\ [], http_opts \\ []) View Source