feat: DX improvements - #94
Merged
Merged
Conversation
added 4 commits
August 19, 2026 03:11
- Config.Level initial level threshold (zero = no override) - WithStdlibContext alias on LogLayer and LogBuilder - cli: per-stream TTY detection in ColorAuto - cli: Config.MessageFn full-line takeover - docs: New vs Build, Fatal guidance, KV-only idiom, transport IDs Changeset: go.loglayer.dev:minor, transports/cli:minor
- metadata.md: replace empty KV-only section with the planned example - cli.md: MessageFn example uses p.LogLevel (field is LogLevel, not Level) - cli.md/whats-new/changeset: MessageFn replaces message + logfmt/table body; the user prefix (WithPrefix) still renders - whats-new: drop empty structured scope paragraph
- llms-full.txt: MessageFn statement says the user prefix (WithPrefix) still applies, matching cli.md and the changeset - metadata.md: KV-only comment matches verified output (sorted keys; console always / cli with ShowFields; msg:"" reverted behavior) - metadata.md: intro aligns with MetadataFieldName sibling (whole value nests when set) - llms-full.txt: define the context in the WithStdlibContext snippet - transports/configuration.md: drop misleading group-routing reason - getting-started.md: wrap Build error with fmt.Errorf; cross-link New vs Build - cli_test.go: TestMessageFnSanitized covers the CSI family (2J, K)
p.Messages is []any; the previous strings.Join(p.Messages, " ") form required []string and did not compile. Use the canonical transport.JoinMessages helper (the idiom in console.md and creating-transports.md) and drop the now-unused strings import.
theogravity
force-pushed
the
dx/loglayer-feedback
branch
from
August 21, 2026 08:05
a1438c3 to
3a3eb4a
Compare
added 4 commits
August 21, 2026 09:22
Compile-checked and run-verified every Go block under docs/src/, README.md, llms.txt, and llms-full.txt against the real modules. Fixed ~65 inaccuracies: - structured output order: metadata renders last, after Data keys (README, index, introduction, configuration, loghttp, combining-example) - nested map keys render sorted (json.Marshal): getting-started, loghttp, sloghandler - WithFields result discarded in examples (mocking, error-handling) - LogLine struct: 6 fields including Prefix (mocking, testing, testing-plugins) - pretty: custom-theme example now compiles (Style is func(string) string, not SprintFunc); inline/expanded output key order + padding - console: MessageFn example used undefined stringifyMessages; now transport.JoinMessages - RunContract sub-test count 14 -> 17 (testing-transports, creating-transports) - wrapper transport output comments: zerolog/zap/slog/phuslu/charmlog key order, always-present ts/caller/time fields, charmlog timestamp format, phuslu os.Exit(255) - cloud transports: missing imports (os, time, otellog), axiom package collision + env-var auth prose, betterstack http URL panic, lumberjack Config.MinLevel -> Config.Level, http Entry struct fields - llms files: missing errors import, pretty.MoonlightTheme -> pretty.Moonlight(), nonexistent Indent field, betterstack /v2 path, Child() snapshot semantics, lazy-eval out-of-scope claim - groups: nonexistent datadogtransport package - redact: example consistent with its own anchored patterns - cheatsheet: Source cost ~600ns/+5 allocs; Remove* returns bool - creating-plugins: redact implements three hooks - sloghandler: error-serialization prose corrected; source field in output
- error-handling.md: UnwrappingErrorSerializer output shows causes before message (json.Marshal sorts map keys); matches the already-fixed getting-started.md - cli.md, whats-new.md, changeset: per-stream ColorAuto level lists now include trace (stdout) and panic (stderr), matching the code and the already-fixed llms files - writers.md: console default-sink row includes trace/panic
Runs the same per-module scan CI uses (scripts/foreach-module.sh vuln) so a push that would fail CI on a known vulnerability fails locally first. Hard-fails when govulncheck is missing, matching the staticcheck pre-commit convention; bypass one push with --no-verify (e.g. a stdlib-only finding awaiting a Go toolchain upgrade).
Adds scripts/govulncheck-gate.sh and wires it into the pre-push hook via lefthook.yml. The gate fails on reachable NON-stdlib (dependency) vulnerabilities, which the repo can fix by bumping the dep; stdlib findings (net/url, crypto/tls, x509: fixed only by a Go toolchain upgrade) are reported advisory, since the repo cannot fix them and hard-failing every push on them would block work until the operator upgrades Go (AGENTS.md documents this as the operator's job). Fixes the one reachable dependency finding: bumps google.golang.org/grpc v1.79.3 -> v1.82.1 in transports/gcplogging (plus transitive upgrades) to clear GO-2026-6061, reachable via SendToLogger/reportError. Adds a patch changeset.
added 2 commits
August 21, 2026 11:56
The govulncheck job ran scripts/foreach-module.sh vuln, which hard-fails on ANY finding including stdlib ones (net/url, crypto/tls, x509) that only a Go toolchain upgrade can fix - causing CI to fail on toolchain-environment issues the repo can't resolve. Switch to scripts/govulncheck-gate.sh so CI fails only on reachable dependency vulnerabilities (the repo's responsibility), matching the local pre-push gate. Also bump the pinned govulncheck from v1.1.4 to v1.7.0 so newer advisories are included.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
All changes are additive; bump levels are
:minorfor both packages (go.loglayer.dev,transports/cli) via the changeset.loglayer(core)Config.Level: initial level threshold applied at construction, exactly likeSetLevel. Zero value means no override (every level enabled, previous behavior preserved). Composes withDisabled. Unknown levels no-op. Covers feedback chore: release main #1.WithStdlibContext: discoverability alias forWithContexton both*LogLayerand*LogBuilder.WithContextremains canonical. Covers feedback docs(badges): link version badge to module-specific releases #4.transports/cliColorAuto: info / debug / trace follow stdout's TTY status; warn / error / fatal / panic follow stderr's. Resolution pinned at construction.cli ... | lesskeeps severity lines colored. Counter-direction: a real*os.Filestderr plus a non-TTY stdout now renders warn/error uncolored. Covers feedback docs(readme): add version badge to header #8.Config.MessageFn: full-line takeover of the output line (replaces message, user-prefix rendering, and logfmt/table body). Level prefix and its color still apply; empty return falls back; return value sanitized. Covers feedback chore(release-please): expose refactor and force v2.0.0 #9.Docs
configuration.md: new## New vs Build,## Level, Fatal-in-worker warning (feedback chore: release main #2, chore: release main #3)basic-logging.md: Fatal skips deferred cleanup warning (feedback chore: release main #3)go-context.md+cheatsheet.md:WithStdlibContextmetadata.md:MetadataOnlyKV-only idiom + map-vs-struct shapes (feedback refactor(fmtlog)!: move fmtlog into plugins/ #7, chore: release main #10); cli renders blank withoutShowFieldsmocking.md: NewMock captures nothing; use buffer/testing transports for rendered-output asserts (feedback refactor: split the last four bundled packages so go.loglayer.dev hosts only the framework core #13)transports/configuration.md+management.md: transport ID +go.loglayer.dev/v2/transportimport pattern (feedback docs: bump release status and add version badge to nav #6)cli.md:ColorAutoper-stream +MessageFnsectionsllms.txt/llms-full.txt/whats-new.mdupdatedDeliberately not changed
TransportCloseTimeout).MessageFnkeeps its documented logfmt-tail behavior; the escape hatch lives in cli's newMessageFn.msgomission was designed, reviewed, and reverted: the output-shape change would force a module-path migration to/v3for a tiny benefit, so it ships as a future breaking change instead.Verification
go build/go vet/go fmt/staticcheckclean in all touched modulesscripts/foreach-module.sh test: all 30 modules passdocs:buildclean; all new anchors resolve*os.Filestreamsgolang.org/x/syspromoted to a direct require intransports/cli(test imports it)