Add more logging and make logging context clearer

This is now actually useful if you want to debug why your swagger YAML
isn't producing a table you think it should be.
This commit is contained in:
Kegan Dougal 2015-09-23 15:36:13 +01:00
parent f1adad5fb3
commit 6afdfc0771
3 changed files with 34 additions and 8 deletions

View file

@ -22,7 +22,11 @@ class Units(object):
def log(self, text):
if self.debug:
print "batesian:units: %s" % text
func_name = ""
trace = inspect.stack()
if len(trace) > 1 and len(trace[1]) > 2:
func_name = trace[1][3] + ":"
print "batesian:units:%s %s" % (func_name, text)
def get_units(self, debug=False):
unit_list = inspect.getmembers(self, predicate=inspect.ismethod)