puppetlabs/puppetdb — pull request #394 by cprice-puppet (2013-01-04 22:51:29+00:00)
Title: Add utils for capturing log output during testing

This commit adds a macro and a couple of functions to the testutils
namespace. The macro, `with-log-output`, simplifies the process
of temporarily redirecting and capturing logging output during
tests. The utility functions `logs-matching` and `num-logs-matching`
provide a means for searching through the captured logs for log
entries whose log messages match a specified regular expression
pattern. Because the log entries generated by `clojure.tools.logging`
are structured as sequences, these functions are useful because they
prevent you from needing to remember that the actual log messages are
at index 3 inside of these log entry sequences.