[pypy-svn] r68811 - pypy/branch/logging/pypy/rlib
arigo at codespeak.net
arigo at codespeak.net
Wed Oct 28 12:20:20 CET 2009
Author: arigo
Date: Wed Oct 28 12:20:19 2009
New Revision: 68811
Modified:
pypy/branch/logging/pypy/rlib/rlog_parsing.py
Log:
Allow an optional second argument to filter out matches
based on the category. It can contain "?" or "*".
Modified: pypy/branch/logging/pypy/rlib/rlog_parsing.py
==============================================================================
--- pypy/branch/logging/pypy/rlib/rlog_parsing.py (original)
+++ pypy/branch/logging/pypy/rlib/rlog_parsing.py Wed Oct 28 12:20:19 2009
@@ -78,9 +78,16 @@
if __name__ == '__main__':
- import sys, re
+ import sys, re, fnmatch
+ filename = sys.argv[1]
+ if len(sys.argv) > 2:
+ limit = sys.argv[2] + '*'
+ else:
+ limit = '*'
r_replace = re.compile(r"%\(\w+\)")
- for curtime, cat, entries in parse_log(sys.argv[1]):
+ for curtime, cat, entries in parse_log(filename):
+ if not fnmatch.fnmatch(cat.category, limit):
+ continue
try:
printcode = cat.printcode
except AttributeError:
More information about the Pypy-commit
mailing list