|
From: | Nathan Brazil |
Subject: | Re: [Fab-user] TImestamp data in output |
Date: | Thu, 6 Mar 2014 21:59:38 -0800 |
This is what I do... I configured Python's logging library to output additional information, including timestamp, like so: logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s') logger = logging.getLogger() logger.setLevel(logging.INFO) I also wrote a decorator like so: def trace(f): def _trace(f, *args, **kw): logger.info('calling %s with args %s, %s' % (f.__name__, args, kw)) return f(*args, **kw) return decorator(_trace, f) Lastly, I decorated my tasks: @task @trace def do_something(arg1, arg2): logging.info('About to do something') ... logging.info('Done') Now I get timestamped output at the beginning as well as throughout my tasks. One bonus behavior is that fabric also uses the logging facility, so that I get extra output from fabric as well. -- On Mar 5, 2014, at 7:37 PM, Brent Nikolaus <address@hidden> wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |