First commit

This commit is contained in:
2026-07-06 06:00:10 +06:00
commit 68696fa4d2
32 changed files with 1085 additions and 0 deletions

32
part2-logstats/README.md Normal file
View File

@ -0,0 +1,32 @@
# Part 2 — logstats: debug a small CLI
`logstats` summarises log files by severity level. It is a two-module tool:
`logstats/parser.py` does the counting, `logstats/cli.py` is the command-line
front end.
Log lines look like this (see `sample.log`):
```
2024-03-01 09:00:00 INFO service started
2024-03-01 09:00:04 ERROR payment gateway timeout
```
Usage:
```bash
python -m logstats.cli sample.log # counts per level
python -m logstats.cli a.log b.log --top 2 # aggregate files, top 2 levels
```
## Your task
The tool has bugs. The test suite describes the intended behaviour and
currently fails. Debug the tool until the suite passes:
```bash
pip install -e ".[dev]"
python -m pytest
```
Fix the causes, not the symptoms — we read the diff, not just the test
output. Note anything interesting in the repository-level `NOTES.md`.