From: David LePage on
Hi -
I have been struggling with this problem for quite some time and was hoping somebody could give me some pointers.

I have a wxPython front end wizard that collects some information and outputs some HTML pages (not hosted by a web server, but viewable locally on the machine running the application).

The problem that i'm trying to solve is taking data collected along the way and outputting this into these HTML pages.

One of the pages is simply collecting debug information about the execution of the program.
All logging is currently being done using the python logging library.

Due to the fact that my HTML files need to be populated in the <body> tags, I wanted to write directly to the proper HTML page based on the logging level message (INFO, DEBUG, etc).

Something like this works nicely if you have a dictionary storing the data:

def template():
return open("html/html.tmpl", 'r').read() % vars

print template("html/Logs.html", { 'body' : "A test body field" })


But in my case, some of the data could be MB in size and I didn't want to read/write that entire load of data before displaying the pages if at all possible.
I was hoping I could tie the logging classes into something like this, where I was leveraging an HTML template, but also taking advantage of the logging library since it works nicely for me today.

Does anybody have any suggestions on how they might approach this problem?

thanks!

DLP




From: Gabriel Genellina on
En Sat, 03 Apr 2010 20:42:20 -0300, David LePage <dwlepage(a)yahoo.com>
escribi�:

> The problem that i'm trying to solve is taking data collected along the
> way and outputting this into these HTML pages.
> [...]
> I was hoping I could tie the logging classes into something like this,
> where I was leveraging an HTML template, but also taking advantage of
> the logging library since it works nicely for me today.

Try this recipe:
http://code.activestate.com/recipes/577025-loggingwebmonitor-a-central-logging-server-and-mon/

--
Gabriel Genellina