   end
 
   test "metadata defaults" do
-    Logger.configure_backend(:console,
-      format: "$metadata", metadata: [:file, :line, :module, :function])
+    Logger.configure_backend(:console, format: "$metadata", metadata: [
+      :file,
+      :line,
+      :module,
+      :function
+    ])
 
     %{module: mod, function: {name, arity}, file: file, line: line} = __ENV__
 
     assert capture_log(fn ->
-      Logger.debug("hello")
-    end) =~ "file=#{file} line=#{line + 3} module=#{inspect(mod)} function=#{name}/#{arity}"
+             Logger.debug("hello")
+           end) =~
+             "file=#{file} line=#{line + 3} module=#{inspect(mod)} function=#{name}/#{arity}"
   end
 
   test "can configure level" do
     Logger.configure_backend(:console, level: :info)
 
     assert capture_log(fn ->
-      Logger.debug("hello")
-    end) == ""
+             Logger.debug("hello")
+           end) == ""
   end
 
   test "can configure colors" do
-    Logger.configure_backend(:console, [format: "$message", colors: [enabled: true]])
+    Logger.configure_backend(:console, format: "$message", colors: [enabled: true])
 
     assert capture_log(fn ->
-      Logger.debug("hello")
-    end) == IO.ANSI.cyan() <> "hello" <> IO.ANSI.reset()
+             Logger.debug("hello")
+           end) == IO.ANSI.cyan() <> "hello" <> IO.ANSI.reset()
 
-    Logger.configure_backend(:console, [colors: [debug: :magenta]])
+    Logger.configure_backend(:console, colors: [debug: :magenta])
 
     assert capture_log(fn ->
-      Logger.debug("hello")
-    end) == IO.ANSI.magenta() <> "hello" <> IO.ANSI.reset()
+             Logger.debug("hello")
+           end) == IO.ANSI.magenta() <> "hello" <> IO.ANSI.reset()
 
     assert capture_log(fn ->
-      Logger.info("hello")
-    end) == IO.ANSI.normal() <> "hello" <> IO.ANSI.reset()
+             Logger.info("hello")
+           end) == IO.ANSI.normal() <> "hello" <> IO.ANSI.reset()
 
-    Logger.configure_backend(:console, [colors: [info: :cyan]])
+    Logger.configure_backend(:console, colors: [info: :cyan])
 
     assert capture_log(fn ->
-      Logger.info("hello")
-    end) == IO.ANSI.cyan() <> "hello" <> IO.ANSI.reset()
+             Logger.info("hello")
+           end) == IO.ANSI.cyan() <> "hello" <> IO.ANSI.reset()
 
     assert capture_log(fn ->
-      Logger.warn("hello")
-    end) == IO.ANSI.yellow() <> "hello" <> IO.ANSI.reset()
+             Logger.warn("hello")
+           end) == IO.ANSI.yellow() <> "hello" <> IO.ANSI.reset()
 
-    Logger.configure_backend(:console, [colors: [warn: :cyan]])
+    Logger.configure_backend(:console, colors: [warn: :cyan])
 
     assert capture_log(fn ->
-      Logger.warn("hello")
-    end) == IO.ANSI.cyan() <> "hello" <> IO.ANSI.reset()
+             Logger.warn("hello")
+           end) == IO.ANSI.cyan() <> "hello" <> IO.ANSI.reset()
 
     assert capture_log(fn ->
-      Logger.error("hello")
-    end) == IO.ANSI.red() <> "hello" <> IO.ANSI.reset()
+             Logger.error("hello")
+           end) == IO.ANSI.red() <> "hello" <> IO.ANSI.reset()
 
-    Logger.configure_backend(:console, [colors: [error: :cyan]])
+    Logger.configure_backend(:console, colors: [error: :cyan])
 
     assert capture_log(fn ->
-      Logger.error("hello")
-    end) == IO.ANSI.cyan() <> "hello" <> IO.ANSI.reset()
+             Logger.error("hello")
+           end) == IO.ANSI.cyan() <> "hello" <> IO.ANSI.reset()
   end
 
   test "can use colors from metadata" do
-    Logger.configure_backend(:console, [format: "$message", colors: [enabled: true]])
+    Logger.configure_backend(:console, format: "$message", colors: [enabled: true])
 
     assert capture_log(fn ->
-      Logger.log(:error, "hello", ansi_color: :yellow)
-    end) == IO.ANSI.yellow() <> "hello" <> IO.ANSI.reset()
+             Logger.log(:error, "hello", ansi_color: :yellow)
+           end) == IO.ANSI.yellow() <> "hello" <> IO.ANSI.reset()
   end
 end

  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


    %{module: mod, function: {name, arity}, file: file, line: line} = __ENV__

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

    assert log =~ "file=#{file}"
    assert log =~ "line=#{line + 3}"
