Time for action - customizing log processor output

Let's revisit and extend our web server log processor now. Our first versions simply printed text to sys.stdout when information was encountered. Let's expand upon that a bit. Using Python's built-in string formatters, we'll do a better job at reporting what we find. In fact, we'll delegate that responsibility to the classes responsible for evaluating the parsed log data.

We'll also add some additional processing meta-output as well, such as how many lines we've processed and how long it takes to execute the entire report. This is helpful information as we further extend our log processor.

  1. We're going to use logscan-c.py from Chapter 2, Working with the IO System as our base here, so copy it over ...

Get Python 2.6 Text Processing Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.