Timber v3.0.0-alpha.2 Timber.Events.HTTPRequestEvent View Source

The HTTPRequestEvent tracks HTTP requests.

This gives you structured into the HTTP request coming into your app as well as the ones going out (if you choose to track them).

The defined structure of this data can be found in the log event JSON schema: https://github.com/timberio/log-event-json-schema

Timber can automatically track incoming HTTP requests if you use a Plug based framework. See the documentation for Timber.Integerations.EventPlug for more information. The README.md also outlines how to set this up.

Link to this section Summary

Functions

Message to be used when logging

Builds a new struct taking care to

Link to this section Types

Link to this type t() View Source
t() :: %Timber.Events.HTTPRequestEvent{
  body: String.t() | nil,
  direction: String.t() | nil,
  headers: map() | nil,
  headers_json: String.t() | nil,
  host: String.t() | nil,
  method: String.t(),
  path: String.t() | nil,
  port: pos_integer() | nil,
  query_string: String.t() | nil,
  request_id: String.t() | nil,
  scheme: String.t() | nil,
  service_name: nil | String.t()
}

Link to this section Functions

Link to this function message(event) View Source
message(t()) :: IO.chardata()

Message to be used when logging.

Builds a new struct taking care to:

  • Parsing the :url and mapping it to the appropriate attributes.
  • Normalize header values so they are consistent.
  • Normalize the method.
  • Removes “” or nil values.