You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
634 B
25 lines
634 B
3 weeks ago
|
# split_logs.py
|
||
|
|
||
|
def split_logs(input_file):
|
||
|
modules = {
|
||
|
"resize1": [],
|
||
|
"png2bmp1": [],
|
||
|
"lpd_wasm1": [],
|
||
|
"cifar10_1": [],
|
||
|
"work1": []
|
||
|
}
|
||
|
|
||
|
with open(input_file, 'r') as f:
|
||
|
for line in f:
|
||
|
for module in modules.keys():
|
||
|
if module in line:
|
||
|
modules[module].append(line.strip())
|
||
|
break
|
||
|
|
||
|
for module, entries in modules.items():
|
||
|
with open(f"{module}.txt", 'w') as outfile:
|
||
|
outfile.write("\n".join(entries) + "\n")
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
split_logs("sledge.log")
|