« elsdoerfer.name


A Python Client library for Gurock Software's SmartInspect logging tool. It was written against SmartInspect version 2 (2.3.3) and might not work with the new version 3 (or maybe it does - I simply haven't testet it. If you have information regarding this, let me know and I'll update this page).

It's a pretty direct port of the Delphi library that is part of SmartInspect, and thus not as pythonic as it could be - though I took some liberties where it seemed to make sense. Most significantly perhaps, all identifier were converted to conform to Python style guidelines (lower_case_with_underscores).

Unfortunately, it's not entirely complete: Only the TCP and memory protocols are implemented, file and text are missing.

See also the original blog entry presenting this library.


Here are a couple of examples - more in the readme and test files:

>>> from smartinspect.auto import *
>>> si.enabled = True
>>> si.log_debug("hello world!")

Manual initialization, without using the smartinspect.auto module:

>>> from smartinspect import *
>>> si = SmartInspect("myapp")
>>> si.connections = "tcp(port=4444, timeout=10)"
>>> si.enabled = True
>>> logger = si.add_session("main")
>>> logger.log_debug("hello world!")

Manually logging process flow:

>>> def append(self, obj):
>>>     logger.enter_method("append", self)
>>>     try:
>>>         pass   # so something
>>>     finally:
>>>         logger.leave_method("append", self)

Logging process flow using the decorator:

>>> @logger.track
>>> def append(self, obj):
>>>     pass   # so something

download & code

The code is available in a git repository on Github.

Fork me on GitHub