 
     try do
       Process.unregister(:user)
-      assert :gen_event.add_handler(Logger, Logger.Backends.Console, :console) ==
-             {:error, :ignore}
+
+      assert :gen_event.add_handler(Logger, Logger.Backends.Console, :console) == {
+               :error,
+               :ignore
+             }
     after
       Process.register(user, :user)
     end

    Logger.configure_backend(:console, device: :standard_error)

    assert capture_io(:standard_error, fn ->
      Logger.debug("hello")
      Logger.flush()
    end) =~ "hello"
  end

  test "can configure format" do
    Logger.configure_backend(:console, format: "$message [$level]")

    assert capture_log(fn ->
      Logger.debug("hello")
    end) =~ "hello [debug]"
  end

  test "can configure metadata" do
    Logger.configure_backend(:console, format: "$metadata$message", metadata: [:user_id])

    assert capture_log(fn ->
      Logger.debug("hello")
    end) =~ "hello"

    Logger.metadata(user_id: 11)
    Logger.metadata(user_id: 13)

    assert capture_log(fn ->
      Logger.debug("hello")
    end) =~ "user_id=13 hello"
  end

  test "can configure formatter to {module, function} tuple" do
    Logger.configure_backend(:console, format: {__MODULE__, :format})

    assert capture_log(fn ->
      Logger.debug("hello")
    end) =~ "my_format: hello"
  end

  def format(_level, message, _ts, _metadata) do

  import ExUnit.CaptureIO

  setup do
    on_exit(fn ->
      :ok =
        Logger.configure_backend(
          :console,
          format: nil,
          device: :user,
          level: nil,
          metadata: [],
          colors: [enabled: false]
        )
    end)
  end

  test "does not start when there is no user" do
