| Trees | Indices | Help |
|
|---|
|
|
object --+
|
Logger
This is the actual wrapper class. The wrapper is fairly thin; it only has one methods of its own: - _LoggerGetLog() and then several instance variables: - _loggerFlushCommand - _loggerClass - _loggerObj - _loggerCommandLog - _loggerIgnore These names were chosen to minimize the likelihood of a collision with the attributes of a wrapped class. Obviously... ;-) The general idea of using this is that you wrap a class in the logger, and then use the class as you normally would. Whenever you want to get the contents of the log (for example after running your program for a while), you can call _loggerCommandLog. The resulting list can be played back in another (or the same) object using the replay() function defined below. The logger can, optionally, be set to flush its log whenever a method with a particular name is invoked. For example, you may want to be wrapping some kind of drawing canvas and want to reset the log whenever the canvas is cleared because there's no point in storing commands which will have no effect on the final drawing. **Note** because of the way I've worked this, the log will actually be flushed whenever the client program accesses the flush method, it need not be invoked. i.e. if the loggerFlushCommand is 'foo', then doing either wrappedObj.foo() or wrappedObj.foo will reset the log. This is undesirable and will most likely be fixed in a future version
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
Constructor
**Arguments**
The one required argument here is _klass_, which is the class
to be wrapped.
**Optional Keyword Arguments**
- loggerFlushCommand: the name of the attribute which will flush the log
- loggerIgnore: a list of regexps defining methods which should not be
logged
**All other arguments are passed to the constructor for _klass_ **
|
Returns the contents of the command log as a python list
|
here's where the logging of method invocations takes place
|
setattr calls (i.e. wrappedObject.foo = 1) are also logged
|
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0beta1 on Sat May 24 08:37:06 2008 | http://epydoc.sourceforge.net |