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

Add level_contains_ok() to Log::Any::Test #75

Open
alabamapaul opened this issue Apr 22, 2018 · 1 comment
Open

Add level_contains_ok() to Log::Any::Test #75

alabamapaul opened this issue Apr 22, 2018 · 1 comment

Comments

@alabamapaul
Copy link
Contributor

The contains_ok() method is great, but it would be nice to specify a log level as well.
Maybe something like:
$log->level_contains_ok("warn", qr/Ooops/, "Found expected log message");

@preaction
Copy link
Owner

Yeah, that sounds like a great idea! I could even see adding it as an optional first argument to contains_ok (despite how ugly that'd make unpacking @_).

$log->contains_ok( qr{failed} ); # Log contains 'failed' at any level
$log->contains_ok( warn => qr{failed} ); # Log contains 'failed' at 'warn' level

Looking at the code, though, it doesn't look like the regex was ever required to be a regex, since it's just interpolated into a /.../, so it will indeed have to be level_contains_ok and level_does_not_contain_ok.

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

No branches or pull requests

2 participants