Context: Imagine you have a standard hello word application for CherryPy:
def index(self): return "Hello world!" index.exposed = True
and you would like to do some post-processing, that is, processing a write request, or simply register the fact that we were called from a specific IP address. You would probably do:
def index(self): self.RunMyPostProcessing() return "Hello world!" index.exposed = True
However, this will add your request processing time. (By the way, and probably you will use decorators or an even more complicated method if you want to name it for each function).
Question: Is there a way to create a global chain (buffers) that supports threads, for which each request can write messages (events) that should be written to the log, and some magic functions will capture it and the post-process? Do you know a pattern for such a thing?
I'm sure CherryPy supports something like this :-)
Thanks in advance...
source share