fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] TImestamp data in output


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:

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
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user


reply via email to

[Prev in Thread] Current Thread [Next in Thread]