 
     defmodule Sample do
       def debug do
-        Logger.debug "hello"
+        Logger.debug("hello")
       end
 
       def info do
-        Logger.info "hello"
-      end
-    end
-
-    assert capture_log(fn ->
-      assert Sample.debug == :ok
-    end) == ""
-
-    assert capture_log(fn ->
-      assert Sample.info == :ok
-    end) =~ msg("module=LoggerTest.Sample [info]  hello")
+        Logger.info("hello")
+      end
+    end
+
+    assert capture_log(fn ->
+             assert Sample.debug() == :ok
+           end) == ""
+
+    assert capture_log(fn ->
+             assert Sample.info() == :ok
+           end) =~ msg("module=LoggerTest.Sample [info]  hello")
   after
     Logger.configure(compile_time_purge_level: :debug)
   end

  end

  test "level/0" do
    assert Logger.level == :debug
  end

  test "process metadata" do
    assert Logger.metadata(data: true) == :ok
    assert Logger.metadata == [data: true]
    assert Logger.metadata(data: true) == :ok
    assert Logger.metadata == [data: true]
    assert Logger.metadata(meta: 1) == :ok
    metadata = Logger.metadata
    assert Enum.sort(metadata) == [data: true, meta: 1]
    assert Logger.metadata(data: nil) == :ok
    assert Logger.metadata == [meta: 1]

    assert Logger.reset_metadata([meta: 2]) == :ok
    assert Logger.metadata == [meta: 2]
    assert Logger.reset_metadata([data: true, app: nil]) == :ok
    assert Logger.metadata == [data: true]
    assert Logger.reset_metadata == :ok
    assert Logger.metadata == []
  end

  test "metadata merge" do
    assert Logger.metadata([module: Sample]) == :ok

    assert capture_log(fn ->
      assert Logger.bare_log(:info, "ok", [application: nil, module: LoggerTest]) == :ok
    end) =~ msg("application= module=LoggerTest [info]  ok")
  end

  test "metadata merge when the argument function returns metadata" do
    assert Logger.metadata([module: Sample]) == :ok

    assert capture_log(fn ->
      assert Logger.bare_log(:info, fn -> {"ok", [module: "Function"]} end, [application: nil, module: LoggerTest]) == :ok
    end) =~ msg("application= module=Function [info]  ok")
  end

  test "enable/1 and disable/1" do
    assert Logger.metadata([]) == :ok

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

    assert Logger.disable(self()) == :ok

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

    assert Logger.metadata([]) == :ok

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

    assert Logger.enable(self()) == :ok

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

  test "compare_levels/2" do
    assert Logger.compare_levels(:debug, :debug) == :eq
    assert Logger.compare_levels(:debug, :info)  == :lt
    assert Logger.compare_levels(:debug, :warn)  == :lt
    assert Logger.compare_levels(:debug, :error) == :lt

    assert Logger.compare_levels(:info, :debug) == :gt
    assert Logger.compare_levels(:info, :info)  == :eq
    assert Logger.compare_levels(:info, :warn)  == :lt
    assert Logger.compare_levels(:info, :error) == :lt

    assert Logger.compare_levels(:warn, :debug) == :gt
    assert Logger.compare_levels(:warn, :info)  == :gt
    assert Logger.compare_levels(:warn, :warn)  == :eq
    assert Logger.compare_levels(:warn, :error) == :lt

    assert Logger.compare_levels(:error, :debug) == :gt
    assert Logger.compare_levels(:error, :info)  == :gt
    assert Logger.compare_levels(:error, :warn)  == :gt
    assert Logger.compare_levels(:error, :error) == :eq
  end

  test "debug/2" do
    assert capture_log(fn ->
      assert Logger.debug("hello", []) == :ok
    end) =~ msg_with_meta("[debug] hello")

    assert capture_log(:info, fn ->
      assert Logger.debug("hello", []) == :ok
    end) == ""
  end

  test "info/2" do
    assert capture_log(fn ->
      assert Logger.info("hello", []) == :ok
    end) =~ msg_with_meta("[info]  hello")

    assert capture_log(:warn, fn ->
      assert Logger.info("hello", []) == :ok
    end) == ""
  end

  test "warn/2" do
    assert capture_log(fn ->
      assert Logger.warn("hello", []) == :ok
    end) =~ msg_with_meta("[warn]  hello")

    assert capture_log(:error, fn ->
      assert Logger.warn("hello", []) == :ok
    end) == ""
  end

  test "error/2" do
    assert capture_log(fn ->
      assert Logger.error("hello", []) == :ok
    end) =~ msg_with_meta("[error] hello")
  end

  test "remove unused calls at compile time" do


  setup_all do
    Logger.configure_backend(:console, metadata: [:application, :module])

    on_exit(fn ->
      Logger.configure_backend(:console, metadata: [])
    end)
