

Log Lens
Each log line looks like [LEVEL] module: message, for example [ERROR] auth: token expired. Write summarize_logs(lines) that returns:
counts: how many lines had each level, as a dictionarynoisiest: the module with the most ERROR lines (the one that appears first on a tie), orNoneif there were no errorsskipped: how many lines did not match the format at all
Levels are always capital letters and module names are letters, digits or underscores.
Examples
summarize_logs(['[INFO] web: started', '[ERROR] auth: token expired', '[ERROR] db: timeout', '[ERROR] auth: bad password', 'garbage line', '[WARN] web: slow'])
→ {'counts': {'INFO': 1, 'ERROR': 3, 'WARN': 1}, 'noisiest': 'auth', 'skipped': 1}
summarize_logs(['[INFO] web: ok'])
→ {'counts': {'INFO': 1}, 'noisiest': None, 'skipped': 0}
project.py
PYTHON
Saved as you type
Tests
0 of 4 passing- •mixed logsummarize_logs(['[INFO] web: started', '[ERROR] auth: token expired', '[ERROR] db: timeout', '[ERROR] auth: bad password', 'garbage line', '[WARN] web: slow'])expected {'counts': {'INFO': 1, 'ERROR': 3, 'WARN': 1}, 'noisiest': 'auth', 'skipped': 1}
- •quiet daysummarize_logs(['[INFO] web: ok'])expected {'counts': {'INFO': 1}, 'noisiest': None, 'skipped': 0}
- •empty logsummarize_logs([])expected {'counts': {}, 'noisiest': None, 'skipped': 0}
- •tie goes to the first modulesummarize_logs(['[ERROR] cache: miss', '[ERROR] queue: full'])expected {'counts': {'ERROR': 2}, 'noisiest': 'cache', 'skipped': 0}
On the line
+380 XP
Pass all 4 tests to claim it.
