Skip to content

Commit

Permalink
[doc] add using Logging to examples in Test.@test_logs, fixes JuliaLa…
Browse files Browse the repository at this point in the history
  • Loading branch information
ArunS-tack committed Jun 24, 2021
1 parent e722e4d commit 42da3d4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions stdlib/Test/src/logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,13 @@ We can test the info message using
If we also wanted to test the debug messages, these need to be enabled with the
`min_level` keyword:
using Logging
@test_logs (:info,"Doing foo with n=2") (:debug,"Iteration 1") (:debug,"Iteration 2") min_level=Logging.Debug foo(2)
If you want to test that some particular messages are generated while ignoring the rest,
you can set the keyword `match_mode=:any`:
using Logging
@test_logs (:info,) (:debug,"Iteration 42") min_level=Logging.Debug match_mode=:any foo(100)
The macro may be chained with `@test` to also test the returned value:
Expand Down

0 comments on commit 42da3d4

Please sign in to comment.