Updated codebase to include more logging and also accessing large email directories better.

This commit is contained in:
2026-06-25 08:44:23 +02:00
parent 7bc9d7a901
commit 93099f4d76
3 changed files with 296 additions and 53 deletions
+20 -1
View File
@@ -15,6 +15,7 @@ Designed for setups such as Rocky Linux + Postfix/Dovecot + Rspamd.
- Asks for confirmation before training.
- Refuses broad runs without any filter.
- Deduplicates matches by SHA-256.
- Logs scan progress and summaries to stderr while keeping search results on stdout.
- Extracts single mbox messages to temporary `.eml` files before training.
- Provides `search`, `check`, `train spam` and `train ham` subcommands.
@@ -108,6 +109,22 @@ Skip confirmation for a known-safe batch:
sudo rspamd-mail-trainer train spam --user johannes --from no-reply@example.test --yes
```
Reduce console progress output:
```bash
sudo rspamd-mail-trainer search --quiet --user johannes --from no-reply@example.test
```
Show additional diagnostic details such as duplicate suppression:
```bash
sudo rspamd-mail-trainer search --verbose --user johannes --from no-reply@example.test
```
Progress and warnings are written to stderr. Matching messages and `rspamc`
results are written to stdout, so you can still redirect or pipe search output
without mixing it with progress messages.
## Push to Gitea
Create a new empty repository in Gitea, then run from this directory:
@@ -130,7 +147,9 @@ A Gitea Actions workflow is included at `.gitea/workflows/ci.yml`.
Run tests without external dependencies:
```bash
python3 -m unittest discover -s tests
make test
# or:
PYTHONPATH=src python3 -m unittest discover -s tests
```
Build a Python package: