()
| 20 | |
| 21 | |
| 22 | def collect(): |
| 23 | matched_lines = defaultdict(lambda: []) |
| 24 | for filepath in sorted(get_filepaths()): |
| 25 | with open(filepath, "r") as f: |
| 26 | log = f.read() |
| 27 | for line in log.split("\n"): |
| 28 | s = re.search("(ERR|WARN)", line) |
| 29 | ignored = re.search("(CORS|Deleted bucket)", line) |
| 30 | if s and not ignored: |
| 31 | matched_lines[filepath].append(line) |
| 32 | return matched_lines |
| 33 | |
| 34 | |
| 35 | _date_reg_exp = re.compile('\d{4}-\d{2}-\d{2}') |