feat: replace logging with custom log_all function and truncate benchmark log on start
This commit is contained in:
+24
-18
@@ -2,21 +2,27 @@ TASK: Create a dummy log file with 20 lines of mixed INFO and ERROR messages. Pa
|
||||
----------------------------------------
|
||||
Loading...
|
||||
|
||||
[Agent] Iteration 1/300
|
||||
[Agent] has_tool_calls=true
|
||||
[Agent] Executing 1 tool(s)
|
||||
-> Writing file: dummy_log.txt
|
||||
[2m[parallel] launching write_file[0m
|
||||
[Agent] Iteration 2/300
|
||||
A dummy log file named [33mdummy_log.txt[0m with 20 mixed INFO and ERROR messages has been created. I will now parse this file using Python to count the number of errors and save a JSON summary to [33mlog_analysis.json[0m.
|
||||
[Agent] has_tool_calls=false
|
||||
[Agent] Response indicates incomplete work, auto-continuing
|
||||
[Agent] Iteration 3/300
|
||||
[Agent] has_tool_calls=true
|
||||
[Agent] Executing 1 tool(s)
|
||||
[1m-> Executing Python code[0m
|
||||
[2m[parallel] launching python_execute[0m
|
||||
[Agent] Iteration 4/300
|
||||
The log file [33mdummy_log.txt[0m has been parsed, errors counted, and a JSON summary has been saved to [33mlog_analysis.json[0m. If you need to review the summary or perform further analysis, please let me know!
|
||||
[Agent] has_tool_calls=false
|
||||
[Agent] Completed in 4 iteration(s)
|
||||
[1;34m┌─── Python Source Code ─────────────────────────────────────[0m
|
||||
[1;34m│[0m [2m 1 |[0m [34mimport[0m[33m json[0m
|
||||
[1;34m│[0m [2m 2 |[0m # Create dummy log file[0m
|
||||
[1;34m│[0m [2m 3 |[0m log_lines = [f"{'ERROR' [34mif[0m[33m i % [36m3[0m[33m == [36m0[0m[33m [34melse[0m[33m 'INFO'} message {i}" [34mfor[0m[33m i in range([36m20[0m[33m)][0m
|
||||
[1;34m│[0m [2m 4 |[0m [34mwith[0m[33m open('dummy_log.txt', 'w') [34mas[0m[33m f:[0m
|
||||
[1;34m│[0m [2m 5 |[0m [34mfor[0m[33m line in log_lines:[0m
|
||||
[1;34m│[0m [2m 6 |[0m f.write(line + '\n')[0m
|
||||
[1;34m│[0m [2m 7 |[0m # Parse log file to count errors[0m
|
||||
[1;34m│[0m [2m 8 |[0m error_count = [36m0[0m[33m[0m
|
||||
[1;34m│[0m [2m 9 |[0m [34mwith[0m[33m open('dummy_log.txt', 'r') [34mas[0m[33m f:[0m
|
||||
[1;34m│[0m [2m 10 |[0m [34mfor[0m[33m line in f:[0m
|
||||
[1;34m│[0m [2m 11 |[0m [34mif[0m[33m 'ERROR' in line:[0m
|
||||
[1;34m│[0m [2m 12 |[0m error_count += [36m1[0m[33m[0m
|
||||
[1;34m│[0m [2m 13 |[0m # Create summary[0m
|
||||
[1;34m│[0m [2m 14 |[0m summary = {[0m
|
||||
[1;34m│[0m [2m 15 |[0m "total_lines": [36m20[0m[33m,[0m
|
||||
[1;34m│[0m [2m 16 |[0m "error_count": error_count,[0m
|
||||
[1;34m│[0m [2m 17 |[0m "info_count": [36m20[0m[33m - error_count[0m
|
||||
[1;34m│[0m [2m 18 |[0m }[0m
|
||||
[1;34m│[0m [2m 19 |[0m # Save JSON summary[0m
|
||||
[1;34m│[0m [2m 20 |[0m [34mwith[0m[33m open('log_analysis.json', 'w') [34mas[0m[33m f:[0m
|
||||
[1;34m│[0m [2m 21 |[0m json.dump(summary, f)[0m
|
||||
[1;34m└────────────────────────────────────────────────────────────[0m
|
||||
A dummy log file with 20 lines of mixed INFO and ERROR messages has been created. The log has been parsed to count the errors, and a JSON summary has been saved to 'log_analysis.json'.
|
||||
|
||||
Reference in New Issue
Block a user