It is not necessary to use logging, but a little debug comment A decorator that temporarily devnulls stdout when you want to silence
debug.py
def mute(func):
def _f(*args, **kwargs):
sys.stdout = open(os.devnull, 'w')
res = func(*args, **kwargs)
sys.stdout.close()
sys.stdout = sys.__stdout__
return res
return _f
Reference: Easily cProfile with a decorator http://qiita.com/mojaie/items/e14c3db9f8fdec896f8a
Recommended Posts