Extract Python Tracebacks from text
Project description
A module & command-line tool for extracting Python tracebacks from text.
Extracting tracebacks from bunch of files
Grepping for tracebacks in a pipeline
Displaying all unique tracebacks ordered by the number of occurrences
Using the Python API
Once instantiated, you pass each line to the process method, which will return either None, or a string of a traceback.
>>> from tbgrep import TracebackGrep
>>> extractor = TracebackGrep() >>> for line in file('logfile'): >>> tb = extractor.process(line) >>> if tb: >>> print tb
Instead of displaying each traceback found in the file, tbgrep also supports generating statistics about all tracebacks in the file.
>>> extractor = TracebackGrep(stats=True) >>> for line in file('logfile'): >>> extractor.process(line) >>> extractor.print_stats()
Supported Input Formats
tbgrep can extract tracebacks from logs of various formats. For example, CherryPy starts the traceback on a line with other details (like module, timestamp, etc), but the rest of the trace starts at the beginning of the line. Apache logs, on the other hand, will prefix each line of the traceback with this information. tbgrep is designed to these kinds of situations
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.