Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test for multiple log messages #183

Open
glennmoy opened this issue Nov 12, 2021 · 1 comment
Open

Test for multiple log messages #183

glennmoy opened this issue Nov 12, 2021 · 1 comment

Comments

@glennmoy
Copy link
Member

It would be nice of @test_log could test for multiple messages at the same level from a particular logger.
Below is a MWE of what I was hoping to do:

@test_log(LOGGER, "info", ("message 1", "message 2"), f(args...))

where f(args..) might record:

[info | LOGGER]: This is message 1
[info | LOGGER]: This is message 2

Right now I'm just running f twice, which isn't that inconvenient but might be if it were an expensive function.

@rofinn
Copy link
Member

rofinn commented Nov 12, 2021

Yeah, looks like the current syntax in base Julia does what you want now. The API for those macros was intended to mimic Julia pre-1.0, but it looks like base has made a bunch of changes since then. I don't love the current base syntax, but I think it's worth keeping both APIs in sync as best as possible. Might be related to #146.

https://docs.julialang.org/en/v1/stdlib/Test/#Test.@test_logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants