Michael Pasternak has posted comments on this change.

Change subject: sdk: Add debug logging of the HTTP messages
......................................................................


Patch Set 1:

On 04/30/2012 05:08 PM, [email protected] wrote:
> Juan Hernandez has posted comments on this change.
> 
> 
> Copying the standard output to the log seems challenging 
> to me: how do you capture that output generated with 
> "print" statements? 

class MyLogger(object):
    def __init__(self, logfile):
        self.terminal = sys.stdout
        self.log = open(logfile, "a")

    def write(self, txt):
        self.terminal.write(txt)
        self.log.write(txt)

sys.stdout = MyLogger("/tmp/mylog.txt")

> Assuming that you can, how do you differentiate between 
> the debug output generated by httplib and regular output 
> generated by other parts of the program? 

you can restore sys.stdout after each call in connection

--
To view, visit http://gerrit.ovirt.org/3934
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I82d9101ebae8197df6554992d583faacf6bc2a9d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <[email protected]>
Gerrit-Reviewer: Alex Jia <[email protected]>
Gerrit-Reviewer: Itamar Heim <[email protected]>
Gerrit-Reviewer: Juan Hernandez <[email protected]>
Gerrit-Reviewer: Michael Pasternak <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to