Skip to content

Commit f64ccd0

Browse files
committed
Improve capture_log docs with latest Logger
1 parent 6c463b2 commit f64ccd0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/ex_unit/lib/ex_unit/capture_log.ex

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,20 @@ defmodule ExUnit.CaptureLog do
4242
@doc """
4343
Captures Logger messages generated when evaluating `fun`.
4444
45-
Returns the binary which is the captured output.
45+
Returns the binary which is the captured output. The captured log
46+
messages will be formatted using `Logger.default_formatter/1`. Any
47+
option, besides the `:level`, will be forwarded as an override to
48+
the default formatter.
4649
47-
This function mutes the `:console` backend and captures any log
50+
This function mutes the default logger handler and captures any log
4851
messages sent to Logger from the calling processes. It is possible
4952
to ensure explicit log messages from other processes are captured
5053
by waiting for their exit or monitor signal.
5154
52-
Note that when the `async` is set to `true`, the messages from another
53-
test might be captured. This is OK as long you consider such cases in
54-
your assertions.
55+
Note that when the `async` is set to `true` on `use ExUnit.Case`,
56+
messages from other tests might be captured. This is OK as long
57+
you consider such cases in your assertions, typically by using
58+
the `=~/2` operator to perform partial matches.
5559
5660
It is possible to configure the level to capture with `:level`,
5761
which will set the capturing level for the duration of the
@@ -63,10 +67,6 @@ defmodule ExUnit.CaptureLog do
6367
configured in this function, no message will be captured.
6468
The behaviour is undetermined if async tests change Logger level.
6569
66-
The format, metadata and colors can be configured with `:format`,
67-
`:metadata` and `:colors` respectively. These three options
68-
defaults to the `:console` backend configuration parameters.
69-
7070
To get the result of the evaluation along with the captured log,
7171
use `with_log/2`.
7272
"""

0 commit comments

Comments
 (0)