logger_backends icon indicating copy to clipboard operation
logger_backends copied to clipboard

ExUnit.CaptureLog doesn't work properly anymore

Open wpiekutowski opened this issue 2 years ago • 0 comments

Due to https://github.com/elixir-lang/elixir/issues/12879, I've switched to the legacy logger backend from this repo. It works fine – logs output to console as it used to.

Expected behaviour

capture_log should capture log output, so assertions can be run and no output should be visible in the terminal.

Actual behaviour

Tests that use capture_log output logs to the console. The log gets captured and tests pass as they used to. ex_unit docs state that :console log backend is captured, so this kind of makes sense.

Partial solution

# test.exs

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

This makes capturing work properly – no output to the console, but also no output from log entries that aren't captured, so some issues might be potentially missed.

wpiekutowski avatar Aug 29 '23 15:08 wpiekutowski