Scenario:
- Some other program is periodically appending lines to a log file.
- Your program runs every few minutes and needs to process any new log lines added since the last run.
If it's just a single log file that keeps growing, use log_file_reader.read(...)
.
If it's a log file that is rotated (e.g. by logrotate
), use log_file_reader.read_rotated(...)
.
This is not published to PyPI yet. Just take "log_file_reader.py" and use it.
Make sure you have Poetry installed.
- Make sure dependencies are installed:
poetry install
- Activate local environment:
poetry shell
- Run tests:
pytest --cov=. --cov-branch --cov-report html log_file_reader_test.py
- Coverage report is generated to "htmlcov/index.html".