diff --git a/lib/slack_logger_backend/consumer.ex b/lib/slack_logger_backend/consumer.ex index 3501ea2..36704b3 100644 --- a/lib/slack_logger_backend/consumer.ex +++ b/lib/slack_logger_backend/consumer.ex @@ -4,6 +4,7 @@ defmodule SlackLoggerBackend.Consumer do """ use GenStage alias SlackLoggerBackend.{Formatter, Pool} + require Logger @doc false def start_link([max_demand, min_demand]) do @@ -32,7 +33,13 @@ defmodule SlackLoggerBackend.Consumer do end defp process_events([json | events], state) do - Pool.post(json) + try do + Pool.post(json) + rescue + _ -> + Logger.error("slack_logger_backend could not send event: #{json}") + end + process_events(events, state) end end diff --git a/lib/slack_logger_backend/logger.ex b/lib/slack_logger_backend/logger.ex index 027a0ce..c7c9641 100644 --- a/lib/slack_logger_backend/logger.ex +++ b/lib/slack_logger_backend/logger.ex @@ -39,7 +39,9 @@ defmodule SlackLoggerBackend.Logger do @doc false def handle_event({level, _pid, {_, message, _timestamp, detail}}, %{levels: levels} = state) do - if level in levels do + app = detail[:application] + + if level in levels and app != :slack_logger_backend do do_handle_event(level, message, detail, state.opts) end