In this lab you'll parse a multi-line log string (using io.StringIO to simulate file reading) and produce a summary report.
io.StringIO
Each log line follows this format:
Example: [2024-01-15 08:32:01] ERROR: Database connection timeout
[2024-01-15 08:32:01] ERROR: Database connection timeout
Levels are: INFO, WARNING, ERROR, DEBUG
INFO
WARNING
ERROR
DEBUG
Write a parse_logs(log_data: str) function that:
parse_logs(log_data: str)
Then call parse_logs(LOG_DATA) and print:
parse_logs(LOG_DATA)
Total lines: N
ERROR count: N
WARNING count: N
INFO count: N
ERROR:
First log: TIMESTAMP
Last log: TIMESTAMP