Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Advanced python logging decorators.

Project Description

Have you ever wanted to have logging decorators for logging function calls and for automatic creation of logger object in class, based on class hierarchy.

If your answer is true, here is my implementation https://github.com/offlinehacker/PyLogDecorate. There is very nice option i’ve implemented called subdecorate, enabling for functions in derived classes being logged, even if decorator is only applied on base class function.

This logging decorator implementation can be easily extended.

  • Install:
    python setup.py install or easy_install PyLogDecorate.
  • Example code:
from log import LogCall, LogClass

@LogCall()
def test():
    print "x"

@LogClass({"subdecorate": True})
class test1(object):
    name="kekec"
    name2="kekec2"
    @LogCall({"subdecorate": True, "tracename": "tracetest", "traceattr": "name"})
    def test(self):
        pass

    @LogCall({"subdecorate": True, "tracename": "tracetest", "traceattr": "name2"})
    def test2(self):
        self.logger.debug("Inside base class!")

@LogClass()
class test2(test1):
    def __init__(self):
        pass

    def test(self):
        self.logger.debug("Inside funtion.")
        self.test2()

@LogClass()
class test3(test2):
    def __init__(self):
        pass

    def test(self):
        self.logger.debug("Inside funtion2.")
        self.test2()


test()
b=test3()
c=test2()
b.test()
c.test()
Release History

Release History

This version
History Node

0.333

History Node

0.332

History Node

0.331

History Node

0.33.4

History Node

0.33

History Node

0.32

History Node

0.31

History Node

0.3

History Node

0.2

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
PyLogDecorate-0.333.tar.gz (4.2 kB) Copy SHA256 Checksum SHA256 Source Sep 14, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting