Skip to main content

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://gist.github.com/1214499. 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.

Example code:

from log import LogCall, LogClass

@LogCall() def test(): print “x”

@LogClass({“subdecorate”: True}) class test1(object):

@LogCall({“subdecorate”: True}) def test(self): print “znj”

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

def test(self): print 1/1

test() b=test2() b.test()

Hack on folks :)

Project details


Download files

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

Source Distribution

PyLogDecorate-0.1.tar.gz (3.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page