Revision 1685
Added by Aaron Marcuse-Kubitza over 12 years ago
digir_client | ||
---|---|---|
55 | 55 |
diags_start = '<diagnostics>' |
56 | 56 |
diags_end = '</diagnostics>' |
57 | 57 |
|
58 |
class InputException(Exception): pass |
|
59 |
|
|
58 | 60 |
def main(): |
59 | 61 |
env_names = [] |
60 | 62 |
def usage_err(): |
... | ... | |
74 | 76 |
log_indent = 0 |
75 | 77 |
def log(msg, line_ending='\n'): |
76 | 78 |
sys.stderr.write((' '*log_indent)+msg+line_ending) |
79 |
def debug_log(str_, label=None): |
|
80 |
if debug: |
|
81 |
if label != None: sys.stderr.write(label+':\n') |
|
82 |
sys.stderr.write(str_+'\n') |
|
77 | 83 |
|
78 | 84 |
self_dir = os.path.dirname(__file__) |
79 | 85 |
source = os.popen(self_dir+"/local_ip").read().strip() |
... | ... | |
90 | 96 |
.replace('[start]', str(start)) |
91 | 97 |
.replace('[time]', time) |
92 | 98 |
) |
93 |
if debug: sys.stderr.write(request_xml)
|
|
99 |
debug_log(request_xml, 'request')
|
|
94 | 100 |
this_url = url+'?'+urllib.urlencode({'request': request_xml}) |
95 | 101 |
diag_capture = streams.CaptureStream(streams.TimeoutInputStream( |
96 | 102 |
urllib2.urlopen(this_url), timeout), diags_start, diags_end) |
... | ... | |
103 | 109 |
finally: # still run if break is called |
104 | 110 |
stream.close() |
105 | 111 |
|
106 |
if debug: sys.stderr.write(diag_capture.match)
|
|
112 |
debug_log(diag_capture.match, 'diagnostics')
|
|
107 | 113 |
|
108 | 114 |
main() |
Also available in: Unified diff
digir_client: Label debugging output