Skip to content

v3.0.0

Latest
Compare
Choose a tag to compare
@adriankumpf adriankumpf released this 12 Aug 18:58
· 30 commits to master since this release
v3.0.0
77c14e6

Breaking Changes

  • Migrate built-in HTTP from hackney to Finch
  • Replace the:adapter with the :client option
  • Remove the :proxy option

Changes

  • Log a warning if sending fails
  • Allow messages to be filtered by a metadata key

Bug fixes

  • Escape metadata fields when sending messages
  • Fix deprecation warnings on Elixir 1.15

Upgrade Instructions

Dependencies

Add :finch to your list of dependencies in mix.exs:

def deps do
  [
    {:logger_telegram_backend, "~> 3.0"},
    {:finch, "~> 0.16"},
  ]
end

Adding the backend

  1. In your Application.start/2 callback, add the LoggerTelegramBackend backend:

    def start(_type, _args) do
    +  LoggerTelegramBackend.attach()
  2. Remove the :backends configuration from :logger:

    config :logger,
    - backends: [LoggerTelegramBackend, :console]

Config

Configuration is now done via the LoggerTelegramBackend key:

- config :logger, :telegram,
+ config :logger, LoggerTelegramBackend,
    # ...

HTTP client (optional)

  1. Remove the :adapter configuration

  2. Add the :client option and pass your own module that implements the LoggerTelegramBackend.HTTPClient behaviour

    config :logger, LoggerTelegramBackend,
    -  adapter: {Tesla.Adapter.Gun, []}
    +  client: MyGunAdapter

    See the documentation for LoggerTelegramBackend.HTTPClient for more information.

Proxy (optional)

  1. Remove the :proxy configuration

  2. Add the :client_pool_opts configuration

    config :logger, LoggerTelegramBackend,
    -  proxy: "socks5://127.0.0.1:9050"
    +  client_pool_opts: [conn_opts: [proxy: {:http, "127.0.0.1", 9050, []}]]

    See Pool Configuration Options for further information.

Full Changelog: v2.0.1...v3.0.0