fix: LOW/nit clearance — retier twin dedupe + same-second counter ordering, warn on unknown rotate

- logsetup-2: retier drops a plain file whose .gz twin exists (crash-between-write-and-remove
  residue) up front, so the phantom twin never occupies a retention slot / evicts a real roll.
- logsetup-5: retier breaks mtime ties by the roll counter parsed from the name, so a
  same-second on_start burst tiers newest-first instead of arbitrary listdir order.
- logsetup-3: tiered daily rotator disambiguates an existing dated dest with a counter (no
  clobber on a second same-interval roll).
- logsetup-6: unknown rotate value warns (matching the unknown-output convention) instead of
  silently degrading to a non-rotating file.
- README: size-mode backup naming clarified (numbered flat vs timestamped tiered).
verified stdlib-only; v0.4.0/v0.4.1/size suites still pass. bump v0.4.2 -> v0.4.3

Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
2026-07-01 00:28:18 -04:00
parent 6a10f3acc0
commit b52c1d37fa
5 changed files with 86 additions and 10 deletions
+4 -3
View File
@@ -13,12 +13,12 @@ and emit; their records flow into the handlers `log_setup` wired.
## Install
```
log_setup @ git+ssh://git@git.rethinkstudios.io/rethink-public/log_setup.git@v0.4.2
log_setup @ git+ssh://git@git.rethinkstudios.io/rethink-public/log_setup.git@v0.4.3
```
No dependencies — stdlib only.
Drop the `@v0.4.2` suffix from the line above to install the latest unpinned.
Drop the `@v0.4.3` suffix from the line above to install the latest unpinned.
## Quick start
@@ -45,7 +45,8 @@ emits; the records land in the configured root.
- **Rotation** (`rotate=`):
- `"daily"` (default) — rolls at midnight, dated name into `log_dir`, keeps
`backup_count` days.
- `"size"` — rolls at `max_bytes`, numbered backups in `log_dir`.
- `"size"` — rolls at `max_bytes`; numbered backups (`run.log.1`, `.2`, …) in `log_dir`
for the default flat retention, or timestamped names when tiered retention is on (below).
- `"on_start"` — on startup, moves an existing `run.log` into `log_dir`
(`run.<timestamp>.log[.gz]`) and starts fresh; prunes to `backup_count`.
- `None` — single file, no rotation.