Revision 653b0597 kamaki/client.py

b/kamaki/client.py
39 39
from urlparse import urlparse
40 40

  
41 41

  
42
log = logging.getLogger('kamaki.client')
43

  
44

  
42 45
class ClientError(Exception):
43 46
    def __init__(self, message, status=0, details=''):
44 47
        self.message = message
......
77 80
            headers['Content-Type'] = 'application/json'
78 81
            headers['Content-Length'] = len(body)
79 82
        
80
        logging.debug('%s', '>' * 40)
81
        logging.debug('%s %s', method, path)
83
        log.debug('%s', '>' * 40)
84
        log.debug('%s %s', method, path)
82 85

  
83 86
        for key, val in headers.items():
84
            logging.debug('%s: %s', key, val)
85
        logging.debug('')
87
            log.debug('%s: %s', key, val)
88
        log.debug('')
86 89
        if body:
87
            logging.debug(body)
88
            logging.debug('')
90
            log.debug(body)
91
            log.debug('')
89 92
        
90 93
        conn.request(method, path, body, headers)
91 94

  
92 95
        resp = conn.getresponse()
93
        logging.debug('%s', '<' * 40)
94
        logging.info('%d %s', resp.status, resp.reason)
96
        log.debug('%s', '<' * 40)
97
        log.info('%d %s', resp.status, resp.reason)
95 98
        for key, val in resp.getheaders():
96
            logging.info('%s: %s', key.capitalize(), val)
97
        logging.info('')
99
            log.info('%s: %s', key.capitalize(), val)
100
        log.info('')
98 101
        
99 102
        buf = resp.read()
100 103
        try:

Also available in: Unified diff