Timber v3.0.0-alpha.2 Timber.Config View Source

Link to this section Summary

Functions

Your Timber application API key. This can be obtained after you create your application in https://app.timber.io

Helpful to inspect internal Timber activity; a useful debugging utility. If specified, Timber will write messages to this device. We cannot use the standard Logger directly because it would create an infinite loop

Change the name of the Logger metadata key that Timber uses for events. By default, this is :event

Allows for the sanitizations of custom header keys. This should be used to ensure sensitive data, such as API keys, do not get logged

Configuration for the :body byte size limit in the Timber.Events.HTTP* events. Bodies that exceed this limit will be truncated to this byte limit. The default is 2048 with a maximum allowed value of 8192

Alternate URL for delivering logs. This is helpful if you want to use a proxy, for example

Specify a different JSON encoder function. Timber uses Poison by default. The specified function must take any data structure and return iodata. It should raise on encode failures

Specify the log level that phoenix log lines write to. Such as template renders

Unfortunately the Elixir.Logger produces timestamps with microsecond prevision. In a high volume system, this can produce logs with matching timestamps, making it impossible to preseve the order of the logs. By enabling this, Timber will discard the default Elixir.Logger timestamps and use it’s own with nanosecond precision

Link to this section Functions

Your Timber application API key. This can be obtained after you create your application in https://app.timber.io

Example

config :timber, :api_key, "abcd1234"

Helpful to inspect internal Timber activity; a useful debugging utility. If specified, Timber will write messages to this device. We cannot use the standard Logger directly because it would create an infinite loop.

Change the name of the Logger metadata key that Timber uses for events. By default, this is :event

Example

config :timber, :event_key, :timber_event
Logger.info("test", timber_event: my_event)
Link to this function header_keys_to_sanitize() View Source

Allows for the sanitizations of custom header keys. This should be used to ensure sensitive data, such as API keys, do not get logged.

Note, the keys passed must be lowercase!

Timber normalizes headers to be downcased before comparing them here. For performance reasons it is advised that you pass lower cased keys.

Example

config :timber, :header_keys_to_sanitize, ["my-sensitive-header-name"]

Configuration for the :body byte size limit in the Timber.Events.HTTP* events. Bodies that exceed this limit will be truncated to this byte limit. The default is 2048 with a maximum allowed value of 8192.

Example

config :timber, :http_body_size_limit, 2048

Alternate URL for delivering logs. This is helpful if you want to use a proxy, for example.

Example

config :timber, :http_url, "https://123.123.123.123"
Link to this function json_encoder() View Source
json_encoder() :: (any() -> iodata())

Specify a different JSON encoder function. Timber uses Poison by default. The specified function must take any data structure and return iodata. It should raise on encode failures.

Example

config :timber, :json_encoder, fn map -> encode(map) end
Link to this function phoenix_instrumentation_level(default) View Source
phoenix_instrumentation_level(atom()) :: atom()

Specify the log level that phoenix log lines write to. Such as template renders.

Example

config :timber, :instrumentation_level, :info
Link to this function use_nanosecond_timestamps?() View Source
use_nanosecond_timestamps?() :: boolean()

Unfortunately the Elixir.Logger produces timestamps with microsecond prevision. In a high volume system, this can produce logs with matching timestamps, making it impossible to preseve the order of the logs. By enabling this, Timber will discard the default Elixir.Logger timestamps and use it’s own with nanosecond precision.

Example

config :timber, :nanosecond_timestamps, true