A SmartInspect client library for Python (http://www.gurock.com/products/smartinspect/).
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
smartinspect
tests
.bzrignore
LICENSE
MANIFEST.in
README.md
setup.py

README.md

python-smartinspect

Dependencies:

  • Python 2.5
  • py.test for running the tests

Examples:

Simple Hello World:

>>> 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.enabled = True
>>> logger = si.add_session("main")
>>> logger.log_debug("hello world!")

Logging via tcp to a running SmartInspect Console on localhost

>>> import smartinspect
>>> si = smartinspect.SmartInspect("myapp")
>>> si.connections = "tcp()"
>>> 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

Todo:

  • FileProtocol, TextProtocol
  • Integration with Python Logging
  • @track should log function arguments