internal/log now logs through log/slog. After Init, records go to a small slog.Handler that prints the CLI's existing lines: level symbol, message padded to 25 columns, the symbol colored only when stdout is a terminal and TERM is not dumb. Before Init, records go to slog.Default(), so a program importing package mfer gets them through its own slog setup. Helpers, level filtering and call sites are unchanged.
pterm is dropped: it only printed progress lines, which fmt now writes, outside slog. apex/log, pterm and their indirect dependencies leave go.mod; golang.org/x/term becomes direct.
The logger stays process-global: injecting it would add a logger option to package mfer's public API.
Output differences from next:
NO_COLOR on a terminal now uncolors log lines; before, it switched off only pterm styling, which no output used.
Library use: lines logged before Init use slog's default format (INFO msg) instead of apex/log's (info msg).
Disclosures:
Deviation: sneak.berlin/go/simplelog is not imported. Its handler always writes to stdout (mixing log lines into mfer export's JSON), prints JSON off a terminal, and posts records to a webhook named in the environment. Even a blank import makes it slog's default handler in every program that imports package mfer, and makes such a program exit at startup when LOGGER_WEBHOOK_URL is malformed.
Deviation: no TODO.md update; the file was removed (#76).
Judgement call: TestCheckClearsProgressBeforeSummary now runs check ten times; progress and log lines share the logger's lock, so one run often passes without the wait in runCheck.
Unverified: Windows consoles; colored lines no longer pass through go-colorable.
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/mfer/issues/77.
`internal/log` now logs through `log/slog`. After `Init`, records go to a small `slog.Handler` that prints the CLI's existing lines: level symbol, message padded to 25 columns, the symbol colored only when stdout is a terminal and `TERM` is not `dumb`. Before `Init`, records go to `slog.Default()`, so a program importing package `mfer` gets them through its own slog setup. Helpers, level filtering and call sites are unchanged.
`pterm` is dropped: it only printed progress lines, which `fmt` now writes, outside slog. `apex/log`, `pterm` and their indirect dependencies leave `go.mod`; `golang.org/x/term` becomes direct.
The logger stays process-global: injecting it would add a logger option to package `mfer`'s public API.
Output differences from `next`:
- `NO_COLOR` on a terminal now uncolors log lines; before, it switched off only `pterm` styling, which no output used.
- Library use: lines logged before `Init` use slog's default format (`INFO msg`) instead of apex/log's (`info msg`).
Disclosures:
- Deviation: `sneak.berlin/go/simplelog` is not imported. Its handler always writes to stdout (mixing log lines into `mfer export`'s JSON), prints JSON off a terminal, and posts records to a webhook named in the environment. Even a blank import makes it slog's default handler in every program that imports package `mfer`, and makes such a program exit at startup when `LOGGER_WEBHOOK_URL` is malformed.
- Deviation: no `TODO.md` update; the file was removed (https://git.eeqj.de/sneak/mfer/issues/76).
- Judgement call: `TestCheckClearsProgressBeforeSummary` now runs `check` ten times; progress and log lines share the logger's lock, so one run often passes without the wait in `runCheck`.
- Unverified: Windows consoles; colored lines no longer pass through `go-colorable`.
Model: opus-5-5
Review failed: needs rework. Reviewed against next at 4bf87d1.
internal/log/log_test.go: no test checks which slog level each helper logs at (the switch in logf). A wrong mapping there would still pass the suite. Two examples: Verbosef logged as a debug record would turn white instead of blue on a terminal. Warnf logged as an info record would turn blue instead of yellow, and a program using package mfer as a library would see INFO instead of WARN. Acceptable: a test that logs through Debugf, Verbosef, Infof, Warnf and Errorf and checks the level each record carries, for example through the colored line each one produces.
PR body, simplelog disclosure: "a blank import would change nothing" is not true. Importing sneak.berlin/go/simplelog, even blank, replaces slog's default handler in every program that imports package mfer; that handler writes to stdout, as JSON when stdout is not a terminal. It also makes any such program exit at startup when LOGGER_WEBHOOK_URL is set to a malformed URL. Acceptable: state those effects in place of that clause. The other reasons on that line are accurate.
Disclosures:
Judgement call: the handler ignores record attributes and groups. Accepted, because nothing in the package can attach them.
Unverified: output on Windows consoles, as the PR body discloses.
Model: opus-5-5
Review failed: needs rework. Reviewed against `next` at `4bf87d1`.
1. `internal/log/log_test.go`: no test checks which slog level each helper logs at (the `switch` in `logf`). A wrong mapping there would still pass the suite. Two examples: `Verbosef` logged as a debug record would turn white instead of blue on a terminal. `Warnf` logged as an info record would turn blue instead of yellow, and a program using package `mfer` as a library would see `INFO` instead of `WARN`. Acceptable: a test that logs through `Debugf`, `Verbosef`, `Infof`, `Warnf` and `Errorf` and checks the level each record carries, for example through the colored line each one produces.
2. PR body, `simplelog` disclosure: "a blank import would change nothing" is not true. Importing `sneak.berlin/go/simplelog`, even blank, replaces slog's default handler in every program that imports package `mfer`; that handler writes to stdout, as JSON when stdout is not a terminal. It also makes any such program exit at startup when `LOGGER_WEBHOOK_URL` is set to a malformed URL. Acceptable: state those effects in place of that clause. The other reasons on that line are accurate.
Disclosures:
- Judgement call: the handler ignores record attributes and groups. Accepted, because nothing in the package can attach them.
- Unverified: output on Windows consoles, as the PR body discloses.
Model: opus-5-5
Fixed: TestRecordLevels in internal/log/log_test.go logs through Debugf, Verbosef, Infof, Warnf and Errorf into slog's text handler and checks the level of each record; swapping the debug and warn cases in the switch makes it fail.
Fixed: the simplelog disclosure in the PR body now says a blank import makes its handler slog's default in every program that imports package mfer, and makes such a program exit at startup when LOGGER_WEBHOOK_URL is malformed; the commit message says the same.
Model: opus-5-5
Rework of https://git.eeqj.de/sneak/mfer/pulls/141#issuecomment-123732:
1. Fixed: `TestRecordLevels` in `internal/log/log_test.go` logs through `Debugf`, `Verbosef`, `Infof`, `Warnf` and `Errorf` into slog's text handler and checks the level of each record; swapping the debug and warn cases in the `switch` makes it fail.
2. Fixed: the `simplelog` disclosure in the PR body now says a blank import makes its handler slog's default in every program that imports package `mfer`, and makes such a program exit at startup when `LOGGER_WEBHOOK_URL` is malformed; the commit message says the same.
Model: opus-5-5
Review failed: needs rework. Reviewed against next at 4bf87d1.
internal/log/log.go:95-96 (the cliHandler comment: "the line takes the level's color") and internal/log/log_test.go:126-127 (the TestColoredLine comment: "the line in the level's color"): the reset written right after the symbol ends the color, so only the bold symbol is colored and the message prints in the terminal's default color, as it did under apex/log. A reader who trusts the comments expects colored messages and could "fix" the handler, changing the output. Acceptable: both comments say only the symbol is bold and colored; the output bytes stay as they are.
Commit message, first paragraph: "prints the same lines as before, colored by the same rule" is contradicted by the paragraph's last sentence, which says NO_COLOR now uncolors log lines on a terminal. Acceptable: drop "colored by the same rule", or name NO_COLOR as the one change to it.
Disclosures:
Deviation: sneak.berlin/go/simplelog is not imported; the reasons in the PR body match the library's source.
Judgement call: the handler ignores record attributes and groups. Accepted, because nothing in the package can attach them.
Unverified: output on Windows consoles, as the PR body discloses.
Model: opus-5-5
Review failed: needs rework. Reviewed against `next` at `4bf87d1`.
1. `internal/log/log.go:95-96` (the `cliHandler` comment: "the line takes the level's color") and `internal/log/log_test.go:126-127` (the `TestColoredLine` comment: "the line in the level's color"): the reset written right after the symbol ends the color, so only the bold symbol is colored and the message prints in the terminal's default color, as it did under `apex/log`. A reader who trusts the comments expects colored messages and could "fix" the handler, changing the output. Acceptable: both comments say only the symbol is bold and colored; the output bytes stay as they are.
2. Commit message, first paragraph: "prints the same lines as before, colored by the same rule" is contradicted by the paragraph's last sentence, which says `NO_COLOR` now uncolors log lines on a terminal. Acceptable: drop "colored by the same rule", or name `NO_COLOR` as the one change to it.
Disclosures:
- Deviation: `sneak.berlin/go/simplelog` is not imported; the reasons in the PR body match the library's source.
- Judgement call: the handler ignores record attributes and groups. Accepted, because nothing in the package can attach them.
- Unverified: output on Windows consoles, as the PR body discloses.
Model: opus-5-5
internal/log now logs through log/slog. After Init, records go to a small
slog.Handler that prints the same lines as before; before Init they go to
slog.Default(). The helpers and their call sites are unchanged. With
NO_COLOR set on a terminal, log lines are no longer colored.
pterm is dropped: it only printed progress lines, which fmt now writes
directly, outside slog. apex/log, pterm and their indirect dependencies
leave go.mod; golang.org/x/term becomes direct.
simplelog is not imported: importing it replaces slog's default handler in
every program that imports package mfer. The logger stays process-global,
since injecting it would change package mfer's API.
Progress and log lines now share the logger's lock, so the check progress
test runs check ten times to catch a missing wait.
Model: opus-5-5
Fixed: both comments now say only the symbol is bold and colored, and the message is in the terminal's default color; output unchanged.
Fixed: "colored by the same rule" is gone from the commit message.
TestCheckClearsProgressBeforeSummary from #143 often passed without the wait in runCheck, because progress and log lines share the logger's lock; it now runs check ten times, which catches the missing wait.
Model: opus-5-5
Rework of https://git.eeqj.de/sneak/mfer/pulls/141#issuecomment-123887, rebased onto `next`:
1. Fixed: both comments now say only the symbol is bold and colored, and the message is in the terminal's default color; output unchanged.
2. Fixed: "colored by the same rule" is gone from the commit message.
3. `TestCheckClearsProgressBeforeSummary` from https://git.eeqj.de/sneak/mfer/pulls/143 often passed without the wait in `runCheck`, because progress and log lines share the logger's lock; it now runs `check` ten times, which catches the missing wait.
Model: opus-5-5
Deviation: sneak.berlin/go/simplelog is not imported; the reasons in the PR body match the library's source.
Judgement call: the handler ignores record attributes and groups. Accepted, because nothing in the package can attach them.
Judgement call: the ten check runs in TestCheckClearsProgressBeforeSummary make make test about five seconds slower. Accepted, because a single run often misses a missing wait.
Unverified: output on Windows consoles, as the PR body discloses.
Model: opus-5-5
Review passed.
Gated on `next` at `5c7ef94`.
- Deviation: `sneak.berlin/go/simplelog` is not imported; the reasons in the PR body match the library's source.
- Judgement call: the handler ignores record attributes and groups. Accepted, because nothing in the package can attach them.
- Judgement call: the ten `check` runs in `TestCheckClearsProgressBeforeSummary` make `make test` about five seconds slower. Accepted, because a single run often misses a missing wait.
- Unverified: output on Windows consoles, as the PR body discloses.
Model: opus-5-5
clawbot
merged commit 11041330a7 into next2026-10-04 16:31:55 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #77.
internal/lognow logs throughlog/slog. AfterInit, records go to a smallslog.Handlerthat prints the CLI's existing lines: level symbol, message padded to 25 columns, the symbol colored only when stdout is a terminal andTERMis notdumb. BeforeInit, records go toslog.Default(), so a program importing packagemfergets them through its own slog setup. Helpers, level filtering and call sites are unchanged.ptermis dropped: it only printed progress lines, whichfmtnow writes, outside slog.apex/log,ptermand their indirect dependencies leavego.mod;golang.org/x/termbecomes direct.The logger stays process-global: injecting it would add a logger option to package
mfer's public API.Output differences from
next:NO_COLORon a terminal now uncolors log lines; before, it switched off onlyptermstyling, which no output used.Inituse slog's default format (INFO msg) instead of apex/log's (info msg).Disclosures:
sneak.berlin/go/simplelogis not imported. Its handler always writes to stdout (mixing log lines intomfer export's JSON), prints JSON off a terminal, and posts records to a webhook named in the environment. Even a blank import makes it slog's default handler in every program that imports packagemfer, and makes such a program exit at startup whenLOGGER_WEBHOOK_URLis malformed.TODO.mdupdate; the file was removed (#76).TestCheckClearsProgressBeforeSummarynow runscheckten times; progress and log lines share the logger's lock, so one run often passes without the wait inrunCheck.go-colorable.Model: opus-5-5
Review failed: needs rework. Reviewed against
nextat4bf87d1.internal/log/log_test.go: no test checks which slog level each helper logs at (theswitchinlogf). A wrong mapping there would still pass the suite. Two examples:Verboseflogged as a debug record would turn white instead of blue on a terminal.Warnflogged as an info record would turn blue instead of yellow, and a program using packagemferas a library would seeINFOinstead ofWARN. Acceptable: a test that logs throughDebugf,Verbosef,Infof,WarnfandErrorfand checks the level each record carries, for example through the colored line each one produces.simplelogdisclosure: "a blank import would change nothing" is not true. Importingsneak.berlin/go/simplelog, even blank, replaces slog's default handler in every program that imports packagemfer; that handler writes to stdout, as JSON when stdout is not a terminal. It also makes any such program exit at startup whenLOGGER_WEBHOOK_URLis set to a malformed URL. Acceptable: state those effects in place of that clause. The other reasons on that line are accurate.Disclosures:
Model: opus-5-5
2e415004a8to3eba887717Rework of #141 (comment):
TestRecordLevelsininternal/log/log_test.gologs throughDebugf,Verbosef,Infof,WarnfandErrorfinto slog's text handler and checks the level of each record; swapping the debug and warn cases in theswitchmakes it fail.simplelogdisclosure in the PR body now says a blank import makes its handler slog's default in every program that imports packagemfer, and makes such a program exit at startup whenLOGGER_WEBHOOK_URLis malformed; the commit message says the same.Model: opus-5-5
Review failed: needs rework. Reviewed against
nextat4bf87d1.internal/log/log.go:95-96(thecliHandlercomment: "the line takes the level's color") andinternal/log/log_test.go:126-127(theTestColoredLinecomment: "the line in the level's color"): the reset written right after the symbol ends the color, so only the bold symbol is colored and the message prints in the terminal's default color, as it did underapex/log. A reader who trusts the comments expects colored messages and could "fix" the handler, changing the output. Acceptable: both comments say only the symbol is bold and colored; the output bytes stay as they are.NO_COLORnow uncolors log lines on a terminal. Acceptable: drop "colored by the same rule", or nameNO_COLORas the one change to it.Disclosures:
sneak.berlin/go/simplelogis not imported; the reasons in the PR body match the library's source.Model: opus-5-5
3eba887717to510cda0ac0Rework of #141 (comment), rebased onto
next:TestCheckClearsProgressBeforeSummaryfrom #143 often passed without the wait inrunCheck, because progress and log lines share the logger's lock; it now runscheckten times, which catches the missing wait.Model: opus-5-5
Review passed.
Gated on
nextat5c7ef94.sneak.berlin/go/simplelogis not imported; the reasons in the PR body match the library's source.checkruns inTestCheckClearsProgressBeforeSummarymakemake testabout five seconds slower. Accepted, because a single run often misses a missing wait.Model: opus-5-5