Eric S. Johansson wrote: > I need to to be able to conditionally log based on the method the log > statement is in and one other factor like a log level. in order to do > so, I need to be able to automatically find out the name of the method > and its class but I haven't found out how to do that yet. > > for example, > > class catus(Felis): > def Siamese_cat( yowl, purr, demand_food): > > ... > log("state of litter box %s"% litter_box.smell, level = 1) > > > If the table of methods logged contains "catus.Siamese_cat", then I > would expect to see the output of the log statements in a log file. If > not then I wouldn't see anything in the log. > > Has somebody done this already? Is it even possible to do without > manually adding the class and method information for every log statement? > > a related question is using signals for reloading configurations etc. I > have to find any good examples of how to use signals to cause a > long-running process to reload external data. Any good pointers? > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062
regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden Recent Ramblings http://holdenweb.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list