Skip to content

feat: DX improvements - #94

Merged
theogravity merged 10 commits into
mainfrom
dx/loglayer-feedback
Aug 21, 2026
Merged

theogravity merged 10 commits into
mainfrom
dx/loglayer-feedback

Conversation

@theogravity

@theogravity theogravity commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

All changes are additive; bump levels are :minor for both packages (go.loglayer.dev, transports/cli) via the changeset.

loglayer (core)

  • Config.Level: initial level threshold applied at construction, exactly like SetLevel. Zero value means no override (every level enabled, previous behavior preserved). Composes with Disabled. Unknown levels no-op. Covers feedback chore: release main #1.
  • WithStdlibContext: discoverability alias for WithContext on both *LogLayer and *LogBuilder. WithContext remains canonical. Covers feedback docs(badges): link version badge to module-specific releases #4.

transports/cli

  • Per-stream TTY detection in ColorAuto: info / debug / trace follow stdout's TTY status; warn / error / fatal / panic follow stderr's. Resolution pinned at construction. cli ... | less keeps severity lines colored. Counter-direction: a real *os.File stderr 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

Deliberately not changed

Verification

  • go build / go vet / go fmt / staticcheck clean in all touched modules
  • scripts/foreach-module.sh test: all 30 modules pass
  • docs:build clean; all new anchors resolve
  • Real-PTY tests (Linux, skipped elsewhere) cover both per-stream directions + mixed *os.File streams
  • golang.org/x/sys promoted to a direct require in transports/cli (test imports it)
  • Runtime verification program exercised every documented claim against the code

Theo Gravity 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
theogravity force-pushed the dx/loglayer-feedback branch from a1438c3 to 3a3eb4a Compare August 21, 2026 08:05
Theo Gravity 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.
@theogravity theogravity changed the title feat: DX improvements from hmn-cli migration feedback feat: DX improvements Aug 21, 2026
Theo Gravity 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.
@theogravity
theogravity enabled auto-merge (squash) August 21, 2026 19:01
@theogravity
theogravity merged commit f11afcd into main Aug 21, 2026
13 checks passed
@theogravity
theogravity deleted the dx/loglayer-feedback branch August 21, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant