def test_log_remove_escapes(self): for c in map(chr, range(32)): self.assertNotEqual(utility.log_remove_escapes(c), c) for c in map(chr, range(127, 140)): self.assertNotEqual(utility.log_remove_escapes(c), c) start = "".join(map(chr, range(32))) + "".join(map(chr, range(127, 140))) end = "" for c in map(chr, range(32)): end += utility.log_remove_escapes(c) for c in map(chr, range(127, 140)): end += utility.log_remove_escapes(c) self.assertEqual(utility.log_remove_escapes(start), end)
def test_log_remove_escapes(self): for c in map(chr, range(32)): self.assertNotEqual(utility.log_remove_escapes(c), c) for c in map(chr, range(127, 140)): self.assertNotEqual(utility.log_remove_escapes(c), c) start = ''.join(map(chr, range(32))) + ''.join(map(chr, range(127, 140))) end = '' for c in map(chr, range(32)): end += utility.log_remove_escapes(c) for c in map(chr, range(127, 140)): end += utility.log_remove_escapes(c) self.assertEqual(utility.log_remove_escapes(start), end)
def do_verbose_log(self, content): """ Record in the verbose log the content as defined by Cyclone wrappers. """ content = log_remove_escapes(content) content = log_encode_html(content) try: with open(GLSetting.httplogfile, 'a+') as fd: fdesc.writeToFD(fd.fileno(), content + "\n") except Exception as excep: log.err("Unable to open %s: %s" % (GLSetting.httplogfile, excep))