This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients ezio.melotti, michael.foord, pitrou, vinay.sajip
Date 2013-09-05.20:26:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
It is sometimes useful to check for the log messages emitted by some piece of code (especially a library). Would it be a good idea to add a dedicated assertion method for that? I would propose the following API:

with self.assertLogging("", level="WARN") as cm:

The `cm` context manager could give access to all the log records and formatted output lines for the given logger name (and children) and at least the given logging level. I have something like that here, except not with a dedicated assertion method:
Date User Action Args
2013-09-05 20:26:01pitrousetrecipients: + pitrou, vinay.sajip, ezio.melotti, michael.foord
2013-09-05 20:26:01pitrousetmessageid: <>
2013-09-05 20:26:01pitroulinkissue18937 messages
2013-09-05 20:26:01pitroucreate