Discussion:
[Fab-user] TImestamp data in output
Brent Nikolaus
2014-03-06 03:37:15 UTC
Permalink
Greetings,

I have been using fabric for a while now and one of the downsides that I
have noticed is that all the changes that I push out using fabric don't
have any timestamps I found an old patch that kind of talked about this but
haven't really made any progress.

https://gist.github.com/bitprophet/20a35ef0f3095026b028

Does anyone else have a way to get a timestamp as part of the output.

Thanks,
~Brent
Nathan Brazil
2014-03-07 05:59:38 UTC
Permalink
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.

--
Post by Brent Nikolaus
Greetings,
I have been using fabric for a while now and one of the downsides that I have noticed is that all the changes that I push out using fabric don't have any timestamps I found an old patch that kind of talked about this but haven't really made any progress.
https://gist.github.com/bitprophet/20a35ef0f3095026b028
Does anyone else have a way to get a timestamp as part of the output.
Thanks,
~Brent
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
Loading...